{
  "id": "X9UoVCX9eTY5sX7q",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Calendly Onboarding and Offboarding",
  "tags": [],
  "nodes": [
    {
      "id": "923b4403-8a4a-4668-b8d5-ad9430089749",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        224,
        -64
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-5.1",
          "cachedResultName": "gpt-5.1"
        },
        "options": {},
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "f1754ce4-adc6-48b3-be00-55cfef04b37c",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        32,
        -272
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "combineBy": "combineAll"
      },
      "typeVersion": 3.2
    },
    {
      "id": "c143dbe3-3a93-41e9-a6db-f8c9982665e4",
      "name": "Get row(s) in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -224,
        400
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "={{ $json.Email }}",
              "lookupColumn": "EMAIL"
            },
            {
              "lookupValue": "on",
              "lookupColumn": "CALENDLY"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Nl_YOUR_AWS_SECRET_KEY_HERE/edit#gid=0",
          "cachedResultName": "Foglio1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1Nl_YOUR_AWS_SECRET_KEY_HERE",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Nl_YOUR_AWS_SECRET_KEY_HERE/edit?usp=drivesdk",
          "cachedResultName": "Onboarding and Offboarding"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "45a4c068-a307-486e-8519-f081c8c74d05",
      "name": "If1",
      "type": "n8n-nodes-base.if",
      "position": [
        32,
        400
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "17067ebe-286b-4769-bba8-27968cebb7db",
              "operator": {
                "type": "number",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.row_number }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "db856786-9ea6-4a3c-8bea-e27f1eccd7a2",
      "name": "OpenAI Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        256,
        608
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-5.1",
          "cachedResultName": "gpt-5.1"
        },
        "options": {},
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "4a288c1c-d7e9-4f76-b841-d50f10cdd4e0",
      "name": "Onboarding form",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -528,
        -272
      ],
      "parameters": {
        "options": {},
        "formTitle": "Calendly Onboarding",
        "formFields": {
          "values": [
            {
              "fieldLabel": "First Name",
              "requiredField": true
            },
            {
              "fieldLabel": "Last Name",
              "requiredField": true
            },
            {
              "fieldType": "email",
              "fieldLabel": "Email",
              "requiredField": true
            }
          ]
        },
        "formDescription": "Calendly Onboarding"
      },
      "typeVersion": 2.3
    },
    {
      "id": "2cab77fb-9fc6-4de0-b347-02f5afe44bdd",
      "name": "Offboarding form",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -496,
        400
      ],
      "parameters": {
        "options": {},
        "formTitle": "Calendly Offboarding",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Email",
              "requiredField": true
            }
          ]
        },
        "formDescription": "Calendly Offboarding"
      },
      "typeVersion": 2.3
    },
    {
      "id": "e5410322-0f98-4023-b1fb-1470fc28650c",
      "name": "Set Calendy Organization",
      "type": "n8n-nodes-base.set",
      "position": [
        -256,
        -416
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "e5c1bcd0-6ffb-4f3f-8598-288796c834e8",
              "name": "calendly_organization",
              "type": "string",
              "value": "XXX"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "fdcb696b-6342-4abd-ac8b-40abb5ef9ec6",
      "name": "Set Calendy Organization id",
      "type": "n8n-nodes-base.set",
      "position": [
        1392,
        272
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "e5c1bcd0-6ffb-4f3f-8598-288796c834e8",
              "name": "calendly_organization",
              "type": "string",
              "value": "XXX"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "b00bf6db-5855-4434-b98c-83f461e37912",
      "name": "New user",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -256,
        -80
      ],
      "parameters": {
        "columns": {
          "value": {
            "DATE": "={{ $now.format('dd/LL/yyyy') }}",
            "EMAIL": "={{ $json.Email }}",
            "LAST NAME": "={{ $json['Last Name'] }}",
            "FIRST NAME": "={{ $json['First Name'] }}"
          },
          "schema": [
            {
              "id": "DATE",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "DATE",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "FIRST NAME",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "FIRST NAME",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "LAST NAME",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "LAST NAME",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "EMAIL",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "EMAIL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "CALENDLY",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "CALENDLY",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Nl_YOUR_AWS_SECRET_KEY_HERE/edit#gid=0",
          "cachedResultName": "Foglio1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1Nl_YOUR_AWS_SECRET_KEY_HERE",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Nl_YOUR_AWS_SECRET_KEY_HERE/edit?usp=drivesdk",
          "cachedResultName": "Onboarding and Offboarding"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "b31aa1e5-b44a-48d1-a15e-29610234e158",
      "name": "Email Agent Onboarding",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        368,
        -272
      ],
      "parameters": {
        "text": "=First name: {{ $('Onboarding form').item.json['First Name'] }}\nLaste name: {{ $('Onboarding form').item.json['Last Name'] }}\nEmail: {{ $('Onboarding form').item.json.Email }}",
        "options": {
          "systemMessage": "You are an assistant responsible for generating a professional notification email for the company\u2019s Human Resources manager.\nYou will receive three inputs: `first_name`, `last_name`, and `email`.\n\nYour task is to output **only the full HTML code** of an email informing HR that a new user is ready for Calendly onboarding. The email must include the user\u2019s first name, last name, and email address, and clearly state that this is a **man-in-the-loop approval step**. At the end NOT include an approval button or link.\n\n**Requirements:**\n\n1. **Purpose of the email**\n\n   * Notify HR that a new user is ready for Calendly onboarding.\n   * Present the user\u2019s details: first name, last name, email.\n   * Explain briefly that onboarding will continue only after HR approves via the provided link.\n\n2. **HTML formatting**\n\n   * Produce a complete, valid HTML email with `<html>`, `<head>`, `<body>`, and inline styles.\n   * Keep a clean, professional, corporate tone.\n   * Include a clear call-to-action button for approval at the end of the message.\n\n3. **Output restrictions**\n\n   * Output **only** the final HTML email.\n   * Do not include any commentary, explanations, or markdown.\n"
        },
        "promptType": "define"
      },
      "typeVersion": 3
    },
    {
      "id": "d5a48915-10f6-48b7-bd3e-2453c1b02eca",
      "name": "Email Agent Offboarding",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        368,
        384
      ],
      "parameters": {
        "text": "=First name: {{ $json['FIRST NAME'] }}\nLaste name: {{ $json['LAST NAME'] }}\nEmail: {{ $json.EMAIL }}",
        "options": {
          "systemMessage": "You are an assistant responsible for generating a professional notification email for the company\u2019s Human Resources manager.\nYou will receive three inputs: `first_name`, `last_name`, and `email`.\n\nYour task is to output **only the full HTML code** of an email informing HR that a new user is ready for Calendly offboarding. The email must include the user\u2019s first name, last name, and email address, and clearly state that this is a **man-in-the-loop approval step**. At the end NOT include an approval button or link.\n\n**Requirements:**\n\n1. **Purpose of the email**\n\n   * Notify HR that a new user is ready for Calendly offboarding.\n   * Present the user\u2019s details: first name, last name, email.\n   * Explain briefly that onboarding will continue only after HR approves via the provided link.\n\n2. **HTML formatting**\n\n   * Produce a complete, valid HTML email with `<html>`, `<head>`, `<body>`, and inline styles.\n   * Keep a clean, professional, corporate tone.\n   * Include a clear call-to-action button for approval at the end of the message.\n\n3. **Output restrictions**\n\n   * Output **only** the final HTML email.\n   * Do not include any commentary, explanations, or markdown.\n"
        },
        "promptType": "define"
      },
      "typeVersion": 3
    },
    {
      "id": "1cd15cb5-4d7a-4b43-a1d2-b5342a93c518",
      "name": "Email Man-in-the-loop Onboarding",
      "type": "n8n-nodes-base.gmail",
      "position": [
        784,
        -272
      ],
      "parameters": {
        "sendTo": "=info@n3w.it",
        "message": "={{ $json.output }}",
        "options": {
          "limitWaitTime": {
            "values": {
              "resumeUnit": "minutes",
              "resumeAmount": 45
            }
          }
        },
        "subject": "=Start Calendly Onboarding for user {{ $('Onboarding form').item.json['First Name'] }} {{ $('Onboarding form').item.json['Last Name'] }}? ",
        "operation": "sendAndWait",
        "approvalOptions": {
          "values": {
            "approvalType": "double"
          }
        }
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "1b4b1849-9aeb-49fb-a60b-0313bf591cf3",
      "name": "Email Man-in-the-loop Offboarding",
      "type": "n8n-nodes-base.gmail",
      "position": [
        784,
        384
      ],
      "parameters": {
        "sendTo": "=info@n3w.it",
        "message": "={{ $json.output }}",
        "options": {
          "limitWaitTime": {
            "values": {
              "resumeUnit": "minutes",
              "resumeAmount": 45
            }
          }
        },
        "subject": "=Start Calendly Offboarding for user {{ $('If1').item.json['FIRST NAME'] }} {{ $('If1').item.json['LAST NAME'] }}? ",
        "operation": "sendAndWait",
        "approvalOptions": {
          "values": {
            "approvalType": "double"
          }
        }
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "baa5a02e-34b7-4ae5-90e5-077b4d30a722",
      "name": "Approve onboarding?",
      "type": "n8n-nodes-base.if",
      "position": [
        1056,
        -272
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "8f9c1708-ffe9-4fb7-9931-f00d39f67178",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.data.approved }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "a619ea1b-2939-4f28-8608-1bacc0e77ccf",
      "name": "Approve offboarding?",
      "type": "n8n-nodes-base.if",
      "position": [
        1088,
        384
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "8f9c1708-ffe9-4fb7-9931-f00d39f67178",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.data.approved }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "03afe2cf-126a-4252-9ee5-6039ffb2ffe1",
      "name": "Add user to Calendly",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1328,
        -480
      ],
      "parameters": {
        "url": "=https://api.calendly.com/organizations/{{ $('Set Calendy Organization').item.json.calendly_organization }}/invitations",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "email",
              "value": "={{ $('New user').item.json.EMAIL }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer YOUR_TOKEN_HERE"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "44bf6c4d-9de7-442d-86bf-ad7321fbc330",
      "name": "Get Calendly User",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1632,
        272
      ],
      "parameters": {
        "url": "=https://api.calendly.com/organization_memberships?organization=https%3A%2F%2Fapi.calendly.com%2Forganizations%2F{{ $json.calendly_organization }}&email={{ $('Get row(s) in sheet').item.json.EMAIL }}",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer YOUR_TOKEN_HERE"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "540eb99b-2a75-40f8-a060-ae6a23176c23",
      "name": "Delete Calendly user",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1888,
        272
      ],
      "parameters": {
        "url": "={{ $json.collection[0].uri }}",
        "method": "DELETE",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer YOUR_TOKEN_HERE"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "4563ba78-91d4-4bc1-aacd-e4a6205fb404",
      "name": "Onboarding complete",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1584,
        -480
      ],
      "parameters": {
        "columns": {
          "value": {
            "EMAIL": "={{ $('New user').item.json.EMAIL }}",
            "CALENDLY": "on"
          },
          "schema": [
            {
              "id": "DATE",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "DATE",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "FIRST NAME",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "FIRST NAME",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "LAST NAME",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "LAST NAME",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "EMAIL",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "EMAIL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "CALENDLY",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "CALENDLY",
              "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": [
            "EMAIL"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1Nl_YOUR_AWS_SECRET_KEY_HERE",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Nl_YOUR_AWS_SECRET_KEY_HERE/edit?usp=drivesdk",
          "cachedResultName": "Onboarding and Offboarding"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "b6b1c9f8-98ef-44d8-9a09-ef6069408ef0",
      "name": "End form page onboarding",
      "type": "n8n-nodes-base.form",
      "position": [
        1824,
        -480
      ],
      "parameters": {
        "options": {},
        "operation": "completion",
        "completionTitle": "Onboarding complete",
        "completionMessage": "Onboarding complete"
      },
      "typeVersion": 2.3
    },
    {
      "id": "b52a5e16-3ac2-4a83-ace2-745ac8612b8d",
      "name": "End form page offboarding",
      "type": "n8n-nodes-base.form",
      "position": [
        1888,
        560
      ],
      "parameters": {
        "options": {},
        "operation": "completion",
        "completionTitle": "Onboarding complete",
        "completionMessage": "Onboarding complete"
      },
      "typeVersion": 2.3
    },
    {
      "id": "26aee968-7ef9-4859-8590-5ea632ff0e47",
      "name": "Offboarding complete",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1616,
        560
      ],
      "parameters": {
        "columns": {
          "value": {
            "EMAIL": "={{ $('Get row(s) in sheet').item.json.EMAIL }}",
            "CALENDLY": "off"
          },
          "schema": [
            {
              "id": "DATE",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "DATE",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "FIRST NAME",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "FIRST NAME",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "LAST NAME",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "LAST NAME",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "EMAIL",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "EMAIL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "CALENDLY",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "CALENDLY",
              "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": [
            "EMAIL"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Nl_YOUR_AWS_SECRET_KEY_HERE/edit#gid=0",
          "cachedResultName": "Foglio1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1Nl_YOUR_AWS_SECRET_KEY_HERE",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Nl_YOUR_AWS_SECRET_KEY_HERE/edit?usp=drivesdk",
          "cachedResultName": "Onboarding and Offboarding"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "8f464313-626d-4071-bf9d-20ffa8e9947f",
      "name": "Form ending",
      "type": "n8n-nodes-base.form",
      "position": [
        1344,
        -112
      ],
      "parameters": {
        "options": {},
        "operation": "completion",
        "completionTitle": "Onboarding not approved",
        "completionMessage": "Onboarding not approved"
      },
      "typeVersion": 2.3
    },
    {
      "id": "ee43b012-3407-4fd9-9ff1-a9e9a7aed658",
      "name": "Form ending1",
      "type": "n8n-nodes-base.form",
      "position": [
        1376,
        576
      ],
      "parameters": {
        "options": {},
        "operation": "completion",
        "completionTitle": "Offboarding not approved",
        "completionMessage": "Offboarding not approved"
      },
      "typeVersion": 2.3
    },
    {
      "id": "b7f1d031-aa9f-4705-95b0-1d7f8ed49fb4",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -576,
        -1264
      ],
      "parameters": {
        "width": 768,
        "height": 640,
        "content": "# **Calendly Onboarding and Offboarding process**\nThis n8n workflow automates the entire Calendly onboarding and offboarding process for company users. It relies on form submissions, Google Sheets as a source of truth, AI-generated HR emails, man-in-the-loop approval steps, and direct API interactions with Calendly.\n\nThis workflow automates user onboarding and offboarding processes for Calendly with human approval steps. The system operates through two parallel streams:\n\n**Prerequisites:**\n- Clone this [Google Sheets](https://docs.google.com/spreadsheets/d/1Nl_5MmWcDsmZZ3hEwTUXUVfHLbk1B0vKTjqX2hOMHEQ/edit?usp=sharing) \n- Calendly organization ID and API access\n- Gmail account for sending approval emails\n- OpenAI API access for email generation\n\n## **How it works:**\nThe workflow automates Calendly onboarding and offboarding with HR approvals. It records user data in Google Sheets, generates AI-based approval emails, and uses Calendly\u2019s API to add or remove users after HR confirmation, updating the sheet and notifying users.\n\n## **Setup steps:**\nSet up Google Sheets, Calendly API, Gmail, and OpenAI credentials in n8n. Configure IDs, tokens, and HR email addresses, test both onboarding and offboarding forms, verify email approvals and data flow, then activate the workflow.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "1e85f0d2-c8cb-4eb5-a576-703fd5f2adda",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -576,
        -576
      ],
      "parameters": {
        "color": 7,
        "width": 768,
        "height": 704,
        "content": "## STEP 1 - **Onboarding Process:**\nUsers submit their information (first name, last name, email) through an onboarding form. Data is automatically recorded in a Google Sheets spreadsheet. Set the correct Calendly organization ID in the Set node"
      },
      "typeVersion": 1
    },
    {
      "id": "bd51ee95-3ccf-41fb-9368-712ecd29ff04",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        224,
        -576
      ],
      "parameters": {
        "color": 7,
        "width": 752,
        "height": 704,
        "content": "## STEP 2 - Email notification for HR\nAn AI agent generates a professional HTML email notification for HR. he email is sent to HR with a double-approval mechanism requiring manual confirmation. If approved, the system automatically adds the user to Calendly organization via API"
      },
      "typeVersion": 1
    },
    {
      "id": "00582ad3-c661-4d97-8f95-82a8bdfc6684",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1008,
        -576
      ],
      "parameters": {
        "color": 7,
        "width": 1072,
        "height": 704,
        "content": "## STEP 3 -  Add user to Calendly organization\nIf approved, the system automatically adds the user to Calendly organization via API. The spreadsheet is updated to mark the user as \"on\" for Calendly access. User receives a completion confirmation"
      },
      "typeVersion": 1
    },
    {
      "id": "1316b330-03f8-401e-8245-68a5b966c4b3",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        192
      ],
      "parameters": {
        "color": 7,
        "width": 752,
        "height": 704,
        "content": "## STEP 1 - Offboarding Process\nUsers submit their email through an offboarding form. The system checks Google Sheets to verify the user exists and has Calendly access"
      },
      "typeVersion": 1
    },
    {
      "id": "26da20b0-7242-4258-8e98-ab107df91306",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        224,
        192
      ],
      "parameters": {
        "color": 7,
        "width": 752,
        "height": 704,
        "content": "## STEP 2 -Email notification for HR\nAn AI agent generates an offboarding notification email for HR approval. After HR double-approval, the system retrieves the user's Calendly membership via API"
      },
      "typeVersion": 1
    },
    {
      "id": "f474ee92-aff4-4b89-8f2f-9f766490c264",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1008,
        192
      ],
      "parameters": {
        "color": 7,
        "width": 1072,
        "height": 704,
        "content": "## STEP 3 - Remove user from Calendly organization\nThe user is automatically removed from Calendly organization. The spreadsheet is updated to mark Calendly access as \"off\". User receives offboarding completion confirmation\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "ae68f063-b532-410b-a9c1-32e36f517836",
  "connections": {
    "If1": {
      "main": [
        [
          {
            "node": "Email Agent Offboarding",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "Email Agent Onboarding",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "New user": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Onboarding form": {
      "main": [
        [
          {
            "node": "New user",
            "type": "main",
            "index": 0
          },
          {
            "node": "Set Calendy Organization",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Offboarding form": {
      "main": [
        [
          {
            "node": "Get row(s) in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Calendly User": {
      "main": [
        [
          {
            "node": "Delete Calendly user",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Email Agent Onboarding",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Email Agent Offboarding",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Approve onboarding?": {
      "main": [
        [
          {
            "node": "Add user to Calendly",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Form ending",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) in sheet": {
      "main": [
        [
          {
            "node": "If1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Onboarding complete": {
      "main": [
        [
          {
            "node": "End form page onboarding",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add user to Calendly": {
      "main": [
        [
          {
            "node": "Onboarding complete",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Approve offboarding?": {
      "main": [
        [
          {
            "node": "Set Calendy Organization id",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Form ending1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Delete Calendly user": {
      "main": [
        [
          {
            "node": "Offboarding complete",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Offboarding complete": {
      "main": [
        [
          {
            "node": "End form page offboarding",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email Agent Onboarding": {
      "main": [
        [
          {
            "node": "Email Man-in-the-loop Onboarding",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email Agent Offboarding": {
      "main": [
        [
          {
            "node": "Email Man-in-the-loop Offboarding",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Calendy Organization": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Calendy Organization id": {
      "main": [
        [
          {
            "node": "Get Calendly User",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email Man-in-the-loop Onboarding": {
      "main": [
        [
          {
            "node": "Approve onboarding?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email Man-in-the-loop Offboarding": {
      "main": [
        [
          {
            "node": "Approve offboarding?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}