{
  "nodes": [
    {
      "id": "9e7ab882-9b03-4513-b5f8-3c0244e8f4d2",
      "name": "Google Sheets Trigger",
      "type": "n8n-nodes-base.googleSheetsTrigger",
      "position": [
        -1168,
        4944
      ],
      "parameters": {
        "event": "rowAdded",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyX",
              "unit": "minutes",
              "value": 1
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/19-RMjvyRMBGRFFPGPYCNdu5g1YWhumU7kYyLLn7OKRA/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "19-RMjvyRMBGRFFPGPYCNdu5g1YWhumU7kYyLLn7OKRA",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/19-RMjvyRMBGRFFPGPYCNdu5g1YWhumU7kYyLLn7OKRA/edit?usp=drivesdk",
          "cachedResultName": "Offer Letter"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "3374ad8e-05b4-4e4b-a93c-c30f18817d87",
      "name": "Copy Template1",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -720,
        4928
      ],
      "parameters": {
        "name": "={{ $json.Name }}_offer_letter",
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_GOOGLE_DRIVE_TEMPLATE_FILE_ID"
        },
        "options": {},
        "operation": "copy"
      },
      "typeVersion": 3
    },
    {
      "id": "5aba1b3c-1f81-49ed-820f-40e0b312131b",
      "name": "Update a offer letter1",
      "type": "n8n-nodes-base.googleDocs",
      "position": [
        -496,
        4928
      ],
      "parameters": {
        "actionsUi": {
          "actionFields": [
            {
              "text": "[Candidate Name]",
              "action": "replaceAll",
              "replaceText": "={{ $('Google Sheets Trigger').item.json.Name }}"
            },
            {
              "text": "[Candidate address]",
              "action": "replaceAll",
              "replaceText": "={{ $('Google Sheets Trigger').item.json.Address }}"
            },
            {
              "text": "[Date]",
              "action": "replaceAll",
              "replaceText": "={{ new Date($now).toLocaleDateString('en-In').replace(/\\//g, '-') }}"
            },
            {
              "text": "[Role]",
              "action": "replaceAll",
              "replaceText": "={{ $('Google Sheets Trigger').item.json.Role }}"
            },
            {
              "text": "[Salary]",
              "action": "replaceAll",
              "replaceText": "={{ $('Google Sheets Trigger').item.json['Salary (Lpa)'].toString() }}"
            },
            {
              "text": "[Location]",
              "action": "replaceAll",
              "replaceText": "={{ $('Google Sheets Trigger').item.json.Location }}"
            },
            {
              "text": "[Joining Date]",
              "action": "replaceAll",
              "replaceText": "={{ $('Google Sheets Trigger').item.json['Joining Date'] }}"
            },
            {
              "text": "[Last date]",
              "action": "replaceAll",
              "replaceText": "={{\n  (() => {\n    const d = new Date($now);\n    d.setDate(d.getDate() + 10);\n    return d.toLocaleDateString('en-IN').replace(/\\//g, '-');\n  })()\n}}\n"
            }
          ]
        },
        "operation": "update",
        "documentURL": "={{ $json.id }}"
      },
      "typeVersion": 2
    },
    {
      "id": "b6a6774f-8872-4335-ba0b-ec64cc732c20",
      "name": "Document to PDF1",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -272,
        4928
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.documentId}}"
        },
        "options": {
          "binaryPropertyName": "data",
          "googleFileConversion": {
            "conversion": {
              "docsToFormat": "application/pdf"
            }
          }
        },
        "operation": "download"
      },
      "typeVersion": 3
    },
    {
      "id": "7a24da3b-ca2c-43c9-a592-7e4e6325b7b8",
      "name": "Save PDF to drive1",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -48,
        4928
      ],
      "parameters": {
        "name": "={{ $('Google Sheets Trigger').item.json.Name + \"_\" + new Date().toLocaleDateString('en-IN'); }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_GOOGLE_DRIVE_FOLDER_ID",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1xG2qJ4v50KWQIdyyOZGZcCMgtVCRKvmG",
          "cachedResultName": "Offer_Letter_PDF"
        },
        "inputDataFieldName": "=data"
      },
      "typeVersion": 3
    },
    {
      "id": "036d133c-a3ab-41f6-902b-54cff3624d71",
      "name": "Assign Sharing Rights1",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        176,
        4928
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        },
        "options": {},
        "operation": "share",
        "permissionsUi": {
          "permissionsValues": {
            "role": "reader",
            "type": "anyone"
          }
        }
      },
      "typeVersion": 3
    },
    {
      "id": "5038c36b-f769-4f54-b5b3-d88447e6dfc3",
      "name": "Send a message1",
      "type": "n8n-nodes-base.gmail",
      "position": [
        400,
        4928
      ],
      "parameters": {
        "sendTo": "= {{ $('Google Sheets Trigger').item.json.Email }}",
        "message": "=<!DOCTYPE html>\n<html>\n  <body style=\"font-family: Arial, sans-serif; line-height: 1.6; color: #333; text-align: left;\">\n    <p>Dear <strong>{{ $('Google Sheets Trigger').item.json.Name }}</strong>,</p>\n\n    <p>Congratulations! Please find attached your offer letter for the position of \n      <strong>{{ $('Google Sheets Trigger').item.json.Role }}</strong> at Your Company, Inc.\n    </p>\n\n    <p>Kindly review the document and share your confirmation or any questions you may have.</p>\n\n    <p>Offer Letter: \n      <a href=\"{{ $('Save PDF to drive1').item.json.webViewLink }}\" target=\"_blank\" style=\"color: #1a73e8; text-decoration: none;\">\n        Click here to view/download\n      </a>\n    </p>\n\n    <p>Please respond by clicking one of the options below:</p>\n\n    <p>\n      <a href=\"http://localhost:5678/webhook-test/YOUR_N8N_WEBHOOK_ID?Id={{ $('If4').item.json.Id}}&decision=accepted\" \n         style=\"display: inline-block; padding: 12px 24px; background-color: #28a745; color: white; text-decoration: none; border-radius: 5px; margin-right: 10px;\">\n         Accept Offer\n      </a>\n\n      <a href=\"http://localhost:5678/webhook-test/YOUR_N8N_WEBHOOK_PATH?Id={{ $('If4').item.json.Id}}&decision=rejected\" \n         style=\"display: inline-block; padding: 12px 24px; background-color: #dc3545; color: white; text-decoration: none; border-radius: 5px;\">\n         Decline Offer\n      </a>\n    </p>\n\n    <p>Best regards,<br />\n       <strong>ABC Person</strong><br />\n       HR, Your Company, Inc.\n    </p>\n  </body>\n</html>\n",
        "options": {},
        "subject": "=Job Offer from Your Company, Inc. "
      },
      "typeVersion": 2.2
    },
    {
      "id": "51b33e0f-c82d-40e3-83bb-4277f43d21d9",
      "name": "Webhook1",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -1168,
        5600
      ],
      "parameters": {
        "path": "b04a8eb4-a672-41bd-9c8a-8cb538aaf3b4",
        "options": {}
      },
      "typeVersion": 2.1
    },
    {
      "id": "28f0c6ae-7eb1-49c3-be87-9541cf5dd92c",
      "name": "Thank you to Candidate2",
      "type": "n8n-nodes-base.gmail",
      "position": [
        176,
        5600
      ],
      "parameters": {
        "sendTo": "={{ $('Webhook1').item.json.query.email }}",
        "message": "=<!DOCTYPE html> <html>   <body style=\"font-family: Arial, sans-serif; line-height: 1.6; color: #333; text-align: left;\">     <p>Dear <strong>{{ $('Webhook1').item.json.query.name }}</strong>,</p>      <p>We appreciate the time you took to consider the offer at Your Company, Inc.     </p>      <p> We understand that you have decided not to proceed with the offer. We appreciate the time and consideration you gave during the process.</p>      <p>We hope to stay in touch for future opportunities and wish you the very best in your career endeavors.</p>      <p>Thank you once again for your time and interest in Your Company, Inc.</p>      <p>Best regards,<br />        <strong>ABC Person</strong><br />        HR, Your Company, Inc.     </p>   </body> </html>",
        "options": {},
        "subject": "Update regarding your application"
      },
      "typeVersion": 2.2
    },
    {
      "id": "5c67bd57-4f07-437a-8421-cbfe38e63b07",
      "name": "Ack. Hr1",
      "type": "n8n-nodes-base.gmail",
      "position": [
        176,
        5216
      ],
      "parameters": {
        "sendTo": "YOUR_GMAIL_RECIPIENT_EMAIL",
        "message": "=<!DOCTYPE html>\n<html>\n  <body style=\"font-family: Arial, sans-serif; line-height: 1.6; color: #333; text-align: left;\">\n    <p>Dear HR Team,</p>\n\n    <p>We are pleased to inform you that the candidate \n      <strong>{{ $('Webhook1').item.json.query.name}}</strong> has accepted the offer.\n    </p>\n\n    <p>Please proceed with the necessary onboarding steps and update your records accordingly.</p>\n\n    <p>Best regards,<br />\n       <strong>ABC Person</strong><br />\n       HR, Your Company, Inc.\n    </p>\n  </body>\n</html>\n",
        "options": {},
        "subject": "= Has accepted the offer"
      },
      "typeVersion": 2.2
    },
    {
      "id": "5961482e-9cf8-48d0-92b4-a9b19c4c1f31",
      "name": "Ack. Candidate1",
      "type": "n8n-nodes-base.gmail",
      "position": [
        176,
        5408
      ],
      "parameters": {
        "sendTo": "={{ $('Get row(s) in sheet2').item.json.Email }}",
        "message": "=<!DOCTYPE html> <html>   <body style=\"font-family: Arial, sans-serif; line-height: 1.6; color: #333; text-align: left;\">     <p>Dear <strong>{{ $('Get row(s) in sheet2').item.json.Name }}</strong>,</p>      <p>We are delighted to know that you have accepted our offer at Your Company, Inc.     </p>      <p>On behalf of the team, we would like to warmly welcome you aboard. We are excited to have you join us and look forward to working together.</p>      </strong>.         Please feel free to reach out if you have any questions before your start date.</p>      <p>Once again, thank you for accepting our offer. Welcome to the team!</p>      <p>Best regards,<br />        <strong>ABC Person</strong><br />        HR, Your Company, Inc.     </p>   </body> </html>",
        "options": {},
        "subject": "Welcome to Your Company, Inc."
      },
      "typeVersion": 2.2
    },
    {
      "id": "764c789e-a5f1-4de1-ba79-6fb51a4f044e",
      "name": "Switch1",
      "type": "n8n-nodes-base.switch",
      "position": [
        -272,
        5584
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "dcfbf7a2-a28a-40e2-83e9-37db6f39ad10",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.result }}",
                    "rightValue": "accepted"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "4ad4dafb-f7fe-4dd1-b601-f85d8142b4d6",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.result }}",
                    "rightValue": "rejected"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "73a95a57-a56c-419f-8bbb-40391babb123",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.result }}",
                    "rightValue": "timeout"
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.4
    },
    {
      "id": "e1d70fb9-8f56-4b3b-98c2-e4d4e2cbc4f3",
      "name": "Thank you to Candidate3",
      "type": "n8n-nodes-base.gmail",
      "position": [
        176,
        5792
      ],
      "parameters": {
        "sendTo": "={{ $('Webhook1').item.json.query.email }}",
        "message": "=<!DOCTYPE html>\n<html>\n    <p>Dear {{ $('Webhook1').item.json.query.name }},</p>\n\n    <p>\n      Thank you for taking the time to review our offer.\n    </p>\n\n    <p>\n      As we did not receive a response within the allowed timeframe, the offer has now been closed and is no longer active.\n      Any response submitted after the deadline cannot be considered.\n    </p>\n\n    <p>\n      We appreciate the time and interest you shared with us and wish you all the best in your future endeavors.\n    </p>\n\n    <p>\n      Kind regards,<br>\n      Hiring Team\n    </p>\n</html>",
        "options": {},
        "subject": "Update regarding your application"
      },
      "typeVersion": 2.2
    },
    {
      "id": "169f90ac-1dfc-4ca6-8258-c368fee6d705",
      "name": "Update status in sheet1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        624,
        4928
      ],
      "parameters": {
        "columns": {
          "value": {
            "Id": "={{ $('If4').item.json.Id }}",
            "Date": "={{new Date($now).toLocaleDateString('en-In').replace(/\\//g, '-')}}",
            "Status": "Sent",
            "row_number": 0,
            "Offer Letter": "={{ $('Save PDF to drive1').item.json.webViewLink }}"
          },
          "schema": [
            {
              "id": "Id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Address",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Address",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Role",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Role",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Salary (Lpa)",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Salary (Lpa)",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Location",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Location",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Joining Date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Joining Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Offer Letter",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Offer Letter",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Date",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "number",
              "display": true,
              "removed": false,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Id"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/19-RMjvyRMBGRFFPGPYCNdu5g1YWhumU7kYyLLn7OKRA/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "19-RMjvyRMBGRFFPGPYCNdu5g1YWhumU7kYyLLn7OKRA",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/19-RMjvyRMBGRFFPGPYCNdu5g1YWhumU7kYyLLn7OKRA/edit?usp=drivesdk",
          "cachedResultName": "Offer Letter"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "c8019b87-e7d2-45d7-ba2a-6eaaa15cf919",
      "name": "Update Status to Accepted1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -48,
        5312
      ],
      "parameters": {
        "columns": {
          "value": {
            "Id": "={{ $('Webhook1').item.json.query.Id }}",
            "Status": "Accepted",
            "Response Locked": "True"
          },
          "schema": [
            {
              "id": "Id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Address",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Address",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Role",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Role",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Salary (Lpa)",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Salary (Lpa)",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Location",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Location",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Joining Date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Joining Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Offer Letter",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Offer Letter",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Date",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Response Locked",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Response Locked",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "number",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Id"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/19-RMjvyRMBGRFFPGPYCNdu5g1YWhumU7kYyLLn7OKRA/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "19-RMjvyRMBGRFFPGPYCNdu5g1YWhumU7kYyLLn7OKRA",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/19-RMjvyRMBGRFFPGPYCNdu5g1YWhumU7kYyLLn7OKRA/edit?usp=drivesdk",
          "cachedResultName": "Offer Letter"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "fbde6213-0dca-410f-9995-f3966f22ab85",
      "name": "Update Status to Rejected1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -48,
        5600
      ],
      "parameters": {
        "columns": {
          "value": {
            "Id": "={{ $('Webhook1').item.json.query.Id }}",
            "Status": "Rejected",
            "Response Locked": "True"
          },
          "schema": [
            {
              "id": "Id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Address",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Address",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Role",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Role",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Salary (Lpa)",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Salary (Lpa)",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Location",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Location",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Joining Date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Joining Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Offer Letter",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Offer Letter",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Date",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Response Locked",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Response Locked",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "number",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Id"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/19-RMjvyRMBGRFFPGPYCNdu5g1YWhumU7kYyLLn7OKRA/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "19-RMjvyRMBGRFFPGPYCNdu5g1YWhumU7kYyLLn7OKRA",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/19-RMjvyRMBGRFFPGPYCNdu5g1YWhumU7kYyLLn7OKRA/edit?usp=drivesdk",
          "cachedResultName": "Offer Letter"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "a367c3cf-474c-4b20-bb95-b9ae03b19ebd",
      "name": "Update Status Timeout1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -48,
        5792
      ],
      "parameters": {
        "columns": {
          "value": {
            "Id": "={{ $('Webhook1').item.json.query.Id }}",
            "Status": "TimeOut",
            "Response Locked": "True"
          },
          "schema": [
            {
              "id": "Id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Address",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Address",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Role",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Role",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Salary (Lpa)",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Salary (Lpa)",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Location",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Location",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Joining Date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Joining Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Offer Letter",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Offer Letter",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Date",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Response Locked",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Response Locked",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "number",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Id"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/19-RMjvyRMBGRFFPGPYCNdu5g1YWhumU7kYyLLn7OKRA/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "19-RMjvyRMBGRFFPGPYCNdu5g1YWhumU7kYyLLn7OKRA",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/19-RMjvyRMBGRFFPGPYCNdu5g1YWhumU7kYyLLn7OKRA/edit?usp=drivesdk",
          "cachedResultName": "Offer Letter"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "6a916f1b-685c-46d9-a199-6566aae24ff0",
      "name": "Check Response is Locked?1",
      "type": "n8n-nodes-base.if",
      "position": [
        -720,
        5600
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "816da211-9f51-479b-8092-24815cf0a6ef",
              "operator": {
                "type": "boolean",
                "operation": "equals"
              },
              "leftValue": "={{ $json['Response Locked'] }}",
              "rightValue": true
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "37710648-5c5b-405e-ad1c-d78e0ad8f71f",
      "name": "If4",
      "type": "n8n-nodes-base.if",
      "position": [
        -944,
        4944
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "d7413115-21fc-47af-8cb9-1b6c1ff0c3c7",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.Status }}",
              "rightValue": "Pending"
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "714966fe-6645-4840-8ba9-ca231dfbdc98",
      "name": "Code in JavaScript3",
      "type": "n8n-nodes-base.code",
      "position": [
        -496,
        5600
      ],
      "parameters": {
        "jsCode": "const decision = $('Webhook1').first().json.query.decision;\nconst sendDateStr = $input.first().json.Date;\n\n// parse DD-MM-YYYY\nconst [day, month, year] = sendDateStr.split('-');\nconst sendDate = new Date(year, month - 1, day);\n\n// normalize today\nconst today = new Date();\ntoday.setHours(0, 0, 0, 0);\nsendDate.setHours(0, 0, 0, 0);\n\n// calculate gap in days\nconst diffDays = Math.abs((today - sendDate) / (1000 * 60 * 60 * 24));\n\n\n\nif (diffDays>=10)\n  var output = \"timeout\";\nelse if( decision === \"accepted\")\n  output = \"accepted\"\nelse \n  output = \"rejected\"\n\n// final result\nreturn [\n  {\n    json: {\n      result: output\n    }\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "d6241d20-1153-436a-9dfe-d048fbb05381",
      "name": "Get row(s) in sheet2",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -944,
        5600
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "={{ $json.query.Id }}",
              "lookupColumn": "Id"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEETS_DOCUMENT_ID/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "19-RMjvyRMBGRFFPGPYCNdu5g1YWhumU7kYyLLn7OKRA",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/19-RMjvyRMBGRFFPGPYCNdu5g1YWhumU7kYyLLn7OKRA/edit?usp=drivesdk",
          "cachedResultName": "Offer Letter"
        }
      },
      "typeVersion": 4.7,
      "alwaysOutputData": false
    },
    {
      "id": "59534eff-c940-43fc-b187-b9d8d4765119",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2176,
        4720
      ],
      "parameters": {
        "width": 832,
        "height": 1248,
        "content": "## Automated Offer Letter & Response Tracking Workflow\n\n### How it works\nThis workflow automates the complete offer letter lifecycle.  \nWhen a new candidate row is added to Google Sheets with a **Pending** status, the workflow generates a personalized offer letter using a Google Docs template. The document is filled with candidate details, converted to PDF, saved to Google Drive, shared with public read access, and emailed to the candidate.\n\nThe email contains **Accept** and **Decline** buttons. When the candidate clicks a button, a webhook captures the response. The workflow validates whether the response is still allowed (within the deadline and not already locked). Based on the response, the system updates the candidate status in Google Sheets and sends appropriate follow-up emails to both the candidate and HR.\n\nIf no response is received within the allowed time window, the offer is automatically marked as **Timeout**, locked, and a closure email is sent.\n\n### Setup steps\n1. Connect Google Sheets, Google Docs, Google Drive, and Gmail credentials  \n2. Replace all placeholder IDs (Sheet ID, Drive Folder ID, Webhook paths)  \n3. Ensure the Google Sheet has required columns (Id, Name, Email, Status, Date)  \n4. Keep initial Status as **Pending** to trigger the workflow\n\n### Customization tips\n- Change response deadline by adjusting the date logic in the Code node  \n- Edit email content to match your brand tone  \n- Add Slack or WhatsApp notifications for HR if needed\n"
      },
      "typeVersion": 1
    },
    {
      "id": "6fa85b0e-dd6f-485b-b1e2-44f87247d34c",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1296,
        4720
      ],
      "parameters": {
        "color": 7,
        "width": 2096,
        "height": 432,
        "content": "## 1. Generate & Send Offer Letter\n\n\u2022 Watches Google Sheets for new Pending entries  \n\u2022 Creates offer letter from template  \n\u2022 Converts to PDF, saves to Drive  \n\u2022 Sends email with Accept / Decline buttons\n"
      },
      "typeVersion": 1
    },
    {
      "id": "e0957e0d-bcca-4ff9-887b-dcf8574bbc19",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1296,
        5184
      ],
      "parameters": {
        "color": 7,
        "width": 2112,
        "height": 784,
        "content": "## 2. Capture Response & Follow-Up\n\n\u2022 Receives candidate response via webhook  \n\u2022 Checks response validity & deadline  \n\u2022 Updates final status in Google Sheets  \n\u2022 Sends follow-up emails to candidate & HR\n"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "If4": {
      "main": [
        [
          {
            "node": "Copy Template1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch1": {
      "main": [
        [
          {
            "node": "Update Status to Accepted1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Update Status to Rejected1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Update Status Timeout1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook1": {
      "main": [
        [
          {
            "node": "Get row(s) in sheet2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Copy Template1": {
      "main": [
        [
          {
            "node": "Update a offer letter1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send a message1": {
      "main": [
        [
          {
            "node": "Update status in sheet1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Document to PDF1": {
      "main": [
        [
          {
            "node": "Save PDF to drive1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save PDF to drive1": {
      "main": [
        [
          {
            "node": "Assign Sharing Rights1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript3": {
      "main": [
        [
          {
            "node": "Switch1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) in sheet2": {
      "main": [
        [
          {
            "node": "Check Response is Locked?1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets Trigger": {
      "main": [
        [
          {
            "node": "If4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Assign Sharing Rights1": {
      "main": [
        [
          {
            "node": "Send a message1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Status Timeout1": {
      "main": [
        [
          {
            "node": "Thank you to Candidate3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update a offer letter1": {
      "main": [
        [
          {
            "node": "Document to PDF1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Response is Locked?1": {
      "main": [
        [],
        [
          {
            "node": "Code in JavaScript3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Status to Accepted1": {
      "main": [
        [
          {
            "node": "Ack. Candidate1",
            "type": "main",
            "index": 0
          },
          {
            "node": "Ack. Hr1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Status to Rejected1": {
      "main": [
        [
          {
            "node": "Thank you to Candidate2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}