AutomationFlowsData & Sheets › Booking No Duplicate

Booking No Duplicate

booking no duplicate. Uses httpRequest, supabase. Webhook trigger; 38 nodes.

Webhook trigger★★★★★ complexity38 nodesHTTP RequestSupabase
Data & Sheets Trigger: Webhook Nodes: 38 Complexity: ★★★★★ Added:

This workflow follows the HTTP Request → Supabase recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "createdAt": "2025-02-21T17:47:26.759Z",
  "updatedAt": "2025-02-21T17:52:40.138Z",
  "id": "etQC8Umz0pkphMmE",
  "name": "booking no duplicate",
  "active": false,
  "isArchived": false,
  "nodes": [
    {
      "parameters": {
        "method": "POST",
        "url": "https://services.leadconnectorhq.com/calendars/events/appointments",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept",
              "value": "application/json"
            },
            {
              "name": "Authorization",
              "value": "=Bearer {{ $('Set Variables1').item.json.Authorization }}"
            },
            {
              "name": "Version",
              "value": "2021-04-15"
            }
          ]
        },
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "calendarId",
              "value": "={{ $('Set Variables1').item.json[\"Calendar ID\"] }}"
            },
            {
              "name": "locationId",
              "value": "={{ $('Set Variables1').item.json[\"Location ID\"] }}"
            },
            {
              "name": "contactId",
              "value": "={{ $('Search GHL').item.json.contacts[0].id }}"
            },
            {
              "name": "startTime",
              "value": "={{ $('Switch').item.json.body.args.startTime }}"
            }
          ]
        },
        "options": {}
      },
      "id": "4e2b15fa-070e-4d7c-bb16-b1e92bbf1be9",
      "name": "Create Appointment",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -440,
        120
      ],
      "retryOnFail": true,
      "maxTries": 2,
      "onError": "continueRegularOutput"
    },
    {
      "parameters": {
        "url": "=https://services.leadconnectorhq.com/calendars/{{ $('Set Variables1').item.json['Calendar ID'] }}/free-slots",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "startDate",
              "value": "={{ $json.startDate }}"
            },
            {
              "name": "endDate",
              "value": "={{ $json.endDate }}"
            }
          ]
        },
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept",
              "value": "application/json"
            },
            {
              "name": "Authorization",
              "value": "=Bearer {{ $('Set Variables1').item.json.Authorization }}"
            },
            {
              "name": "Version",
              "value": "2021-04-15"
            }
          ]
        },
        "options": {
          "response": {
            "response": {
              "neverError": true,
              "responseFormat": "text",
              "outputPropertyName": "freeSlots"
            }
          }
        }
      },
      "id": "05bf02a7-71ac-46ba-b440-4f43bd9f1188",
      "name": "get free slots",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        360,
        120
      ],
      "retryOnFail": true,
      "onError": "continueRegularOutput"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "b1257b77-8768-4640-bff9-e529360967e4",
              "name": "Location ID",
              "value": "=GHL Sub-Account Location ID",
              "type": "string"
            },
            {
              "id": "2b33ac83-26b0-45f8-81a2-4e49f7e4052a",
              "name": "Authorization",
              "value": "=PRIVATE INTEGRATION KEY",
              "type": "string"
            },
            {
              "id": "96bdbb04-6e4d-4180-aad1-867453b0d72c",
              "name": "Calendar ID",
              "value": "=Calendar ID",
              "type": "string"
            },
            {
              "id": "a870662c-774a-4257-8f16-9ee4d52812c9",
              "name": "Version",
              "value": "=2021-04-15",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "46cbb71e-590f-4fcd-8900-41e7171b3a5d",
      "name": "Set Variables1",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -1560,
        120
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://services.leadconnectorhq.com/contacts/search",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept",
              "value": "application/json"
            },
            {
              "name": "Authorization",
              "value": "=Bearer {{ $json.Authorization }}"
            },
            {
              "name": "Version",
              "value": "2021-07-28"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"locationId\": \"{{ $json['Location ID'] }}\",\n  \"page\": 1,\n  \"pageLimit\": 20,\n  \"filters\": [\n    {\n      \"field\": \"phone\",\n      \"operator\": \"eq\",\n      \"value\": \"{{ $('Webhook').item.json.body.call.from_number }}\"\n    }\n  ]\n}",
        "options": {}
      },
      "id": "42cb842a-371e-4a8f-9303-ce82f3e12c7f",
      "name": "Search GHL",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -1280,
        120
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://services.leadconnectorhq.com/contacts",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept",
              "value": "application/json"
            },
            {
              "name": "Authorization",
              "value": "=Bearer {{ $('Set Variables1').item.json.Authorization }}"
            },
            {
              "name": "Version",
              "value": "2021-07-28"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"name\": \"{{ $('Webhook').item.json.body.args.full_name }}\",\n  \"locationId\": \"{{ $('Set Variables1').item.json['Location ID'] }}\",\n  \"phone\": \"{{ $('Webhook').item.json.body.args.phone }}\",\n  \"email\": \"{{ $('Webhook').item.json.body.args.email }}\"\n}\n",
        "options": {}
      },
      "id": "298a04fa-0bb0-4c85-a7c2-1ac430a27837",
      "name": "Create Contact1",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -440,
        720
      ],
      "retryOnFail": true,
      "maxTries": 2,
      "onError": "continueErrorOutput"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://services.leadconnectorhq.com/calendars/events/appointments",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept",
              "value": "application/json"
            },
            {
              "name": "Authorization",
              "value": "=Bearer {{ $('Set Variables1').item.json.Authorization }}"
            },
            {
              "name": "Version",
              "value": "2021-04-15"
            }
          ]
        },
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "calendarId",
              "value": "={{ $('Set Variables1').item.json[\"Calendar ID\"] }}"
            },
            {
              "name": "locationId",
              "value": "={{ $('Set Variables1').item.json[\"Location ID\"] }}"
            },
            {
              "name": "contactId",
              "value": "={{ $json.contact.id }}"
            },
            {
              "name": "startTime",
              "value": "={{ $('Switch').item.json.body.args.startTime }}"
            }
          ]
        },
        "options": {}
      },
      "id": "913c57dc-f098-421f-9d18-eab60f7b8065",
      "name": "Create Appointment1",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -200,
        620
      ],
      "retryOnFail": true,
      "maxTries": 2,
      "onError": "continueRegularOutput"
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "=Looks like I had some trouble booking the appointment now, but ill have our team schedule you in after this call!",
        "options": {}
      },
      "id": "38a49263-750d-44da-90ec-a7a33b9dbbb1",
      "name": "Respond to Webhook8",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        -140,
        920
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "b5d4dc3b-e3af-47ca-8d83-fd42584fead3",
              "leftValue": "={{ $json.id }}",
              "rightValue": 201,
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "looseTypeValidation": true,
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        -220,
        120
      ],
      "id": "a0bfa263-3d0b-4a77-a4ad-c77d8b892477",
      "name": "Successful Booking?"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "b5d4dc3b-e3af-47ca-8d83-fd42584fead3",
              "leftValue": "={{ $json.id }}",
              "rightValue": 201,
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "looseTypeValidation": true,
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        80,
        620
      ],
      "id": "48e14078-2798-43da-8a04-c174261d8821",
      "name": "Successful Booking?1"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 1
          },
          "conditions": [
            {
              "id": "b2f1c825-3234-4c28-8cd2-0b547e74b1c0",
              "leftValue": "={{ $json.contacts[0].id }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "afc3c154-37c1-4cf2-b4b6-0159f9d00cc7",
      "name": "Contact Exists",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.1,
      "position": [
        -960,
        120
      ]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ JSON.stringify($json.status + ' ' +$json.appoinmentStatus) }}",
        "options": {}
      },
      "id": "80f9777c-7cdf-4e4f-a2f2-f2ed5e95ff74",
      "name": "Success Reply",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        0,
        0
      ]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ JSON.stringify($('get free slots').first().json.freeSlots) }}",
        "options": {}
      },
      "id": "bd2ae318-c9f4-4c30-ad31-372bed5c435f",
      "name": "Alternative Slots Available",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        860,
        0
      ]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "=No availability for the requested date, please suggest a new date to check for availability. Ask user for a new date to check availability.",
        "options": {}
      },
      "id": "2c445beb-baa3-46cc-b2e8-7652069a7905",
      "name": "No Alternative Slots Available",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        860,
        240
      ]
    },
    {
      "parameters": {
        "url": "=https://services.leadconnectorhq.com/calendars/{{ $('Set Variables1').item.json['Calendar ID'] }}/free-slots",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "startDate",
              "value": "={{ $json.startDate }}"
            },
            {
              "name": "endDate",
              "value": "={{ $json.endDate }}"
            }
          ]
        },
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept",
              "value": "application/json"
            },
            {
              "name": "Authorization",
              "value": "=Bearer {{ $('Set Variables1').item.json.Authorization }}"
            },
            {
              "name": "Version",
              "value": "2021-04-15"
            }
          ]
        },
        "options": {
          "response": {
            "response": {
              "neverError": true,
              "responseFormat": "text",
              "outputPropertyName": "freeSlots"
            }
          }
        }
      },
      "id": "0e7e606f-6a39-43c1-8e8b-bc10d890475b",
      "name": "get free slots1",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        620,
        720
      ],
      "retryOnFail": true,
      "onError": "continueRegularOutput"
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "=No availability for the requested date, please suggest a new date to check for availability. Ask user for a new date to check availability.",
        "options": {}
      },
      "id": "3525fe08-f197-4fb9-87e6-87f06ddcd9c5",
      "name": "No Alternative Slots Available1",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        1160,
        840
      ]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ JSON.stringify($('get free slots').first().json.freeSlots) }}",
        "options": {}
      },
      "id": "5c5c71c1-4b41-4e31-979e-e8e181109ed4",
      "name": "Alternative Slots Available1",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        1160,
        600
      ]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "=That's you booked in!",
        "options": {}
      },
      "id": "cb6459ac-badd-43ac-baeb-30a531afa3e4",
      "name": "Successful Booking",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        340,
        460
      ]
    },
    {
      "parameters": {
        "jsCode": "const appointmentDateTime = new Date($('Webhook').first().json.body.args.appointment_datetime); // ISO 8601 format\n\n// Start Date: Set to 12:00 AM of the appointment day\nconst startDate = new Date(\n  appointmentDateTime.getFullYear(),\n  appointmentDateTime.getMonth(),\n  appointmentDateTime.getDate()\n).getTime(); // Convert to Unix timestamp\n\n// End Date: Set to 11:59 PM of the appointment day\nconst endDate = new Date(\n  appointmentDateTime.getFullYear(),\n  appointmentDateTime.getMonth(),\n  appointmentDateTime.getDate(),\n  23, 59, 59\n).getTime(); // Convert to Unix timestamp\n\n// Return a single object\nreturn {\n  json: {\n    startDate,\n    endDate,\n  },\n};"
      },
      "id": "7e4e4911-2f11-40de-b6d7-89a5cc9742e3",
      "name": "Unix start&end Date",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        320,
        720
      ]
    },
    {
      "parameters": {
        "jsCode": "const appointmentDateTime = new Date($('Webhook').first().json.body.args.appointment_datetime); // ISO 8601 format\n\n// Start Date: Set to 12:00 AM of the appointment day\nconst startDate = new Date(\n  appointmentDateTime.getFullYear(),\n  appointmentDateTime.getMonth(),\n  appointmentDateTime.getDate()\n).getTime(); // Convert to Unix timestamp\n\n// End Date: Set to 11:59 PM of the appointment day\nconst endDate = new Date(\n  appointmentDateTime.getFullYear(),\n  appointmentDateTime.getMonth(),\n  appointmentDateTime.getDate(),\n  23, 59, 59\n).getTime(); // Convert to Unix timestamp\n\n// Return a single object\nreturn {\n  json: {\n    startDate,\n    endDate,\n  },\n};"
      },
      "id": "f95642bc-f820-4e8f-9078-27ba2324b485",
      "name": "Unix start & end date",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        0,
        220
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 1
          },
          "conditions": [
            {
              "id": "3eb820a9-1ce3-4a3a-8ad2-aacb55aa2720",
              "leftValue": "={{ $('get free slots').first().json.freeSlots }}",
              "rightValue": "slots",
              "operator": {
                "type": "string",
                "operation": "contains"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "fb8cbf9c-50d8-410e-983e-9d0ce4b5a9eb",
      "name": "Slots Available? ",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.1,
      "position": [
        620,
        120
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 1
          },
          "conditions": [
            {
              "id": "3eb820a9-1ce3-4a3a-8ad2-aacb55aa2720",
              "leftValue": "={{ $('get free slots1').first().json.freeSlots }}",
              "rightValue": "slots",
              "operator": {
                "type": "string",
                "operation": "contains"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "3c1ab9c7-4bda-4882-9a79-a42bd7009daa",
      "name": "Available Slots?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.1,
      "position": [
        920,
        720
      ]
    },
    {
      "parameters": {
        "content": "# Insert Supabase Metadata flow here\n",
        "width": 328.33172715573,
        "color": 5
      },
      "id": "d1206896-f255-43cb-8289-965278f85f70",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -2340,
        1820
      ]
    },
    {
      "parameters": {
        "tableId": "inbound_calls_phone_pit_locationid_metadata",
        "fieldsUi": {
          "fieldValues": [
            {
              "fieldId": "phone",
              "fieldValue": "={{ $('Webhook').item.json.body.customData['AI Call Phone Number 1'] }}"
            },
            {
              "fieldId": "pit",
              "fieldValue": "={{ $('Webhook').item.json.body.customData['Private Integration Token'] }}"
            },
            {
              "fieldId": "metadata",
              "fieldValue": "={\n    \"metadata\": {\n      \"locationId\": \"{{ $('Webhook').item.json.body.customData['Location ID'] }}\",\n      \"privateIntegrationToken\": \"{{ $('Webhook').item.json.body.customData['Private Integration Token'] }}\",\n      \"accountCompanyName\": \"{{ $('Webhook').item.json.body.customData['Account Company Name'] }}\",\n      \"eventIdId\": \"{{ $('Webhook').item.json.body.customData['Event ID ID'] }}\",\n      \"leadDispositionId\": \"{{ $('Webhook').item.json.body.customData['Lead Disposition ID'] }}\",\n      \"conversationIdId\": \"{{ $('Webhook').item.json.body.customData['Conversation ID ID'] }}\",\n      \"aiCallOutcomeId\": \"{{ $('Webhook').item.json.body.customData['AI Call Outcome ID'] }}\",\n      \"aiCallOutcomeReasonId\": \"{{ $('Webhook').item.json.body.customData['AI Call Outcome Reason ID'] }}\",\n      \"aiCallTranscriptId\": \"{{ $('Webhook').item.json.body.customData['AI Call Transcript ID'] }}\",\n      \"aiCallSummaryId\": \"{{ $('Webhook').item.json.body.customData['AI Call Summary ID'] }}\",\n      \"aiCallRecordingId\": \"{{ $('Webhook').item.json.body.customData['AI Call Recording ID'] }}\",\n      \"aiCallDurationId\": \"{{ $('Webhook').item.json.body.customData['AI Call Duration ID'] }}\",\n      \"aiCallCountId\": \"{{ $('Webhook').item.json.body.customData['AI Call Count ID'] }}\",\n      \"aiCallEndedReasonId\": \"{{ $('Webhook').item.json.body.customData['AI Call Ended Reason ID'] }}\",\n      \"aiCallAppointmentDateTimeId\": \"{{ $('Webhook').item.json.body.customData['AI Call Appointment DateTime ID'] }}\",\n      \"aiCallContactNameId\": \"{{ $('Webhook').item.json.body.customData['AI Call Contact Name ID'] }}\",\n      \"aiCallContactPhoneId\": \"{{ $('Webhook').item.json.body.customData['AI Call Contact Phone ID'] }}\",\n      \"aiCallContactEmailId\": \"{{ $('Webhook').item.json.body.customData['AI Call Contact Email ID'] }}\",\n      \"aiCallTimestampId\": \"{{ $('Webhook').item.json.body.customData['AI Call Timestamp ID'] }}\",\n      \"aiCallTypeId\": \"{{ $('Webhook').item.json.body.customData['AI Call Type ID'] }}\",\n      \"aiCallFollowUpDateTimeId\": \"{{ $('Webhook').item.json.body.customData['AI Call Follow Up DateTime ID'] }}\",\n      \"salesCalendarId\": \"{{ $('Webhook').item.json.body.customData['Sales Calendar ID'] }}\",\n      \"onboardingCalendarId\": \"{{ $('Webhook').item.json.body.customData['Onboarding Calendar ID'] }}\",\n      \"customerSuccessCalendarId\": \"{{ $('Webhook').item.json.body.customData['Customer Success Calendar ID'] }}\",\n      \"accountTimezone\": \"{{ $('Webhook').item.json.body.customData['Account Timezone'] }}\"\n    }\n}"
            },
            {
              "fieldId": "location_id",
              "fieldValue": "={{ $('Webhook').item.json.body.customData['Location ID'] }}"
            }
          ]
        }
      },
      "id": "bd83ffb3-c22c-4a4d-b3ee-8d04ea78a966",
      "name": "Supabase1",
      "type": "n8n-nodes-base.supabase",
      "typeVersion": 1,
      "position": [
        -2220,
        2040
      ]
    },
    {
      "parameters": {
        "tableId": "inbound_calls_phone_pit_locationid_metadata",
        "fieldsUi": {
          "fieldValues": [
            {
              "fieldId": "phone",
              "fieldValue": "={{ $('Webhook').item.json.body.customData['AI Call Phone Number 2'] }}"
            },
            {
              "fieldId": "pit",
              "fieldValue": "={{ $('Webhook').item.json.body.customData['Private Integration Token'] }}"
            },
            {
              "fieldId": "metadata",
              "fieldValue": "={\n    \"metadata\": {\n      \"locationId\": \"{{ $('Webhook').item.json.body.customData['Location ID'] }}\",\n      \"privateIntegrationToken\": \"{{ $('Webhook').item.json.body.customData['Private Integration Token'] }}\",\n      \"accountCompanyName\": \"{{ $('Webhook').item.json.body.customData['Account Company Name'] }}\",\n      \"eventIdId\": \"{{ $('Webhook').item.json.body.customData['Event ID ID'] }}\",\n      \"leadDispositionId\": \"{{ $('Webhook').item.json.body.customData['Lead Disposition ID'] }}\",\n      \"conversationIdId\": \"{{ $('Webhook').item.json.body.customData['Conversation ID ID'] }}\",\n      \"aiCallOutcomeId\": \"{{ $('Webhook').item.json.body.customData['AI Call Outcome ID'] }}\",\n      \"aiCallOutcomeReasonId\": \"{{ $('Webhook').item.json.body.customData['AI Call Outcome Reason ID'] }}\",\n      \"aiCallTranscriptId\": \"{{ $('Webhook').item.json.body.customData['AI Call Transcript ID'] }}\",\n      \"aiCallSummaryId\": \"{{ $('Webhook').item.json.body.customData['AI Call Summary ID'] }}\",\n      \"aiCallRecordingId\": \"{{ $('Webhook').item.json.body.customData['AI Call Recording ID'] }}\",\n      \"aiCallDurationId\": \"{{ $('Webhook').item.json.body.customData['AI Call Duration ID'] }}\",\n      \"aiCallCountId\": \"{{ $('Webhook').item.json.body.customData['AI Call Count ID'] }}\",\n      \"aiCallEndedReasonId\": \"{{ $('Webhook').item.json.body.customData['AI Call Ended Reason ID'] }}\",\n      \"aiCallAppointmentDateTimeId\": \"{{ $('Webhook').item.json.body.customData['AI Call Appointment DateTime ID'] }}\",\n      \"aiCallContactNameId\": \"{{ $('Webhook').item.json.body.customData['AI Call Contact Name ID'] }}\",\n      \"aiCallContactPhoneId\": \"{{ $('Webhook').item.json.body.customData['AI Call Contact Phone ID'] }}\",\n      \"aiCallContactEmailId\": \"{{ $('Webhook').item.json.body.customData['AI Call Contact Email ID'] }}\",\n      \"aiCallTimestampId\": \"{{ $('Webhook').item.json.body.customData['AI Call Timestamp ID'] }}\",\n      \"aiCallTypeId\": \"{{ $('Webhook').item.json.body.customData['AI Call Type ID'] }}\",\n      \"aiCallFollowUpDateTimeId\": \"{{ $('Webhook').item.json.body.customData['AI Call Follow Up DateTime ID'] }}\",\n      \"salesCalendarId\": \"{{ $('Webhook').item.json.body.customData['Sales Calendar ID'] }}\",\n      \"onboardingCalendarId\": \"{{ $('Webhook').item.json.body.customData['Onboarding Calendar ID'] }}\",\n      \"customerSuccessCalendarId\": \"{{ $('Webhook').item.json.body.customData['Customer Success Calendar ID'] }}\",\n      \"accountTimezone\": \"{{ $('Webhook').item.json.body.customData['Account Timezone'] }}\"\n    }\n}"
            },
            {
              "fieldId": "location_id",
              "fieldValue": "={{ $('Webhook').item.json.body.customData['Location ID'] }}"
            }
          ]
        }
      },
      "id": "63b5db9f-943c-49ac-b974-eda7361f0467",
      "name": "Supabase2",
      "type": "n8n-nodes-base.supabase",
      "typeVersion": 1,
      "position": [
        -2220,
        2260
      ]
    },
    {
      "parameters": {
        "tableId": "inbound_calls_phone_pit_locationid_metadata",
        "fieldsUi": {
          "fieldValues": [
            {
              "fieldId": "phone",
              "fieldValue": "={{ $('Webhook').item.json.body.customData['AI Call Phone Number 3'] }}"
            },
            {
              "fieldId": "pit",
              "fieldValue": "={{ $('Webhook').item.json.body.customData['Private Integration Token'] }}"
            },
            {
              "fieldId": "metadata",
              "fieldValue": "={\n    \"metadata\": {\n      \"locationId\": \"{{ $('Webhook').item.json.body.customData['Location ID'] }}\",\n      \"privateIntegrationToken\": \"{{ $('Webhook').item.json.body.customData['Private Integration Token'] }}\",\n      \"accountCompanyName\": \"{{ $('Webhook').item.json.body.customData['Account Company Name'] }}\",\n      \"eventIdId\": \"{{ $('Webhook').item.json.body.customData['Event ID ID'] }}\",\n      \"leadDispositionId\": \"{{ $('Webhook').item.json.body.customData['Lead Disposition ID'] }}\",\n      \"conversationIdId\": \"{{ $('Webhook').item.json.body.customData['Conversation ID ID'] }}\",\n      \"aiCallOutcomeId\": \"{{ $('Webhook').item.json.body.customData['AI Call Outcome ID'] }}\",\n      \"aiCallOutcomeReasonId\": \"{{ $('Webhook').item.json.body.customData['AI Call Outcome Reason ID'] }}\",\n      \"aiCallTranscriptId\": \"{{ $('Webhook').item.json.body.customData['AI Call Transcript ID'] }}\",\n      \"aiCallSummaryId\": \"{{ $('Webhook').item.json.body.customData['AI Call Summary ID'] }}\",\n      \"aiCallRecordingId\": \"{{ $('Webhook').item.json.body.customData['AI Call Recording ID'] }}\",\n      \"aiCallDurationId\": \"{{ $('Webhook').item.json.body.customData['AI Call Duration ID'] }}\",\n      \"aiCallCountId\": \"{{ $('Webhook').item.json.body.customData['AI Call Count ID'] }}\",\n      \"aiCallEndedReasonId\": \"{{ $('Webhook').item.json.body.customData['AI Call Ended Reason ID'] }}\",\n      \"aiCallAppointmentDateTimeId\": \"{{ $('Webhook').item.json.body.customData['AI Call Appointment DateTime ID'] }}\",\n      \"aiCallContactNameId\": \"{{ $('Webhook').item.json.body.customData['AI Call Contact Name ID'] }}\",\n      \"aiCallContactPhoneId\": \"{{ $('Webhook').item.json.body.customData['AI Call Contact Phone ID'] }}\",\n      \"aiCallContactEmailId\": \"{{ $('Webhook').item.json.body.customData['AI Call Contact Email ID'] }}\",\n      \"aiCallTimestampId\": \"{{ $('Webhook').item.json.body.customData['AI Call Timestamp ID'] }}\",\n      \"aiCallTypeId\": \"{{ $('Webhook').item.json.body.customData['AI Call Type ID'] }}\",\n      \"aiCallFollowUpDateTimeId\": \"{{ $('Webhook').item.json.body.customData['AI Call Follow Up DateTime ID'] }}\",\n      \"salesCalendarId\": \"{{ $('Webhook').item.json.body.customData['Sales Calendar ID'] }}\",\n      \"onboardingCalendarId\": \"{{ $('Webhook').item.json.body.customData['Onboarding Calendar ID'] }}\",\n      \"customerSuccessCalendarId\": \"{{ $('Webhook').item.json.body.customData['Customer Success Calendar ID'] }}\",\n      \"accountTimezone\": \"{{ $('Webhook').item.json.body.customData['Account Timezone'] }}\"\n    }\n}"
            },
            {
              "fieldId": "location_id",
              "fieldValue": "={{ $('Webhook').item.json.body.customData['Location ID'] }}"
            }
          ]
        }
      },
      "id": "cc5bc081-769b-44ed-9589-3099904d20f2",
      "name": "Supabase3",
      "type": "n8n-nodes-base.supabase",
      "typeVersion": 1,
      "position": [
        -2220,
        2500
      ]
    },
    {
      "parameters": {
        "tableId": "inbound_calls_phone_pit_locationid_metadata",
        "fieldsUi": {
          "fieldValues": [
            {
              "fieldId": "phone",
              "fieldValue": "={{ $('Webhook').item.json.body.customData['AI Call Phone Number 4'] }}"
            },
            {
              "fieldId": "pit",
              "fieldValue": "={{ $('Webhook').item.json.body.customData['Private Integration Token'] }}"
            },
            {
              "fieldId": "metadata",
              "fieldValue": "={\n    \"metadata\": {\n      \"locationId\": \"{{ $('Webhook').item.json.body.customData['Location ID'] }}\",\n      \"privateIntegrationToken\": \"{{ $('Webhook').item.json.body.customData['Private Integration Token'] }}\",\n      \"accountCompanyName\": \"{{ $('Webhook').item.json.body.customData['Account Company Name'] }}\",\n      \"eventIdId\": \"{{ $('Webhook').item.json.body.customData['Event ID ID'] }}\",\n      \"leadDispositionId\": \"{{ $('Webhook').item.json.body.customData['Lead Disposition ID'] }}\",\n      \"conversationIdId\": \"{{ $('Webhook').item.json.body.customData['Conversation ID ID'] }}\",\n      \"aiCallOutcomeId\": \"{{ $('Webhook').item.json.body.customData['AI Call Outcome ID'] }}\",\n      \"aiCallOutcomeReasonId\": \"{{ $('Webhook').item.json.body.customData['AI Call Outcome Reason ID'] }}\",\n      \"aiCallTranscriptId\": \"{{ $('Webhook').item.json.body.customData['AI Call Transcript ID'] }}\",\n      \"aiCallSummaryId\": \"{{ $('Webhook').item.json.body.customData['AI Call Summary ID'] }}\",\n      \"aiCallRecordingId\": \"{{ $('Webhook').item.json.body.customData['AI Call Recording ID'] }}\",\n      \"aiCallDurationId\": \"{{ $('Webhook').item.json.body.customData['AI Call Duration ID'] }}\",\n      \"aiCallCountId\": \"{{ $('Webhook').item.json.body.customData['AI Call Count ID'] }}\",\n      \"aiCallEndedReasonId\": \"{{ $('Webhook').item.json.body.customData['AI Call Ended Reason ID'] }}\",\n      \"aiCallAppointmentDateTimeId\": \"{{ $('Webhook').item.json.body.customData['AI Call Appointment DateTime ID'] }}\",\n      \"aiCallContactNameId\": \"{{ $('Webhook').item.json.body.customData['AI Call Contact Name ID'] }}\",\n      \"aiCallContactPhoneId\": \"{{ $('Webhook').item.json.body.customData['AI Call Contact Phone ID'] }}\",\n      \"aiCallContactEmailId\": \"{{ $('Webhook').item.json.body.customData['AI Call Contact Email ID'] }}\",\n      \"aiCallTimestampId\": \"{{ $('Webhook').item.json.body.customData['AI Call Timestamp ID'] }}\",\n      \"aiCallTypeId\": \"{{ $('Webhook').item.json.body.customData['AI Call Type ID'] }}\",\n      \"aiCallFollowUpDateTimeId\": \"{{ $('Webhook').item.json.body.customData['AI Call Follow Up DateTime ID'] }}\",\n      \"salesCalendarId\": \"{{ $('Webhook').item.json.body.customData['Sales Calendar ID'] }}\",\n      \"onboardingCalendarId\": \"{{ $('Webhook').item.json.body.customData['Onboarding Calendar ID'] }}\",\n      \"customerSuccessCalendarId\": \"{{ $('Webhook').item.json.body.customData['Customer Success Calendar ID'] }}\",\n      \"accountTimezone\": \"{{ $('Webhook').item.json.body.customData['Account Timezone'] }}\"\n    }\n}"
            },
            {
              "fieldId": "location_id",
              "fieldValue": "={{ $('Webhook').item.json.body.customData['Location ID'] }}"
            }
          ]
        }
      },
      "id": "2dbc4f4b-82a9-49d5-a7d9-6dc6b14bba68",
      "name": "Supabase4",
      "type": "n8n-nodes-base.supabase",
      "typeVersion": 1,
      "position": [
        -2220,
        2740
      ]
    },
    {
      "parameters": {
        "tableId": "inbound_calls_phone_pit_locationid_metadata",
        "fieldsUi": {
          "fieldValues": [
            {
              "fieldId": "phone",
              "fieldValue": "={{ $('Webhook').item.json.body.customData['AI Call Phone Number 5'] }}"
            },
            {
              "fieldId": "pit",
              "fieldValue": "={{ $('Webhook').item.json.body.customData['Private Integration Token'] }}"
            },
            {
              "fieldId": "metadata",
              "fieldValue": "={\n    \"metadata\": {\n      \"locationId\": \"{{ $('Webhook').item.json.body.customData['Location ID'] }}\",\n      \"privateIntegrationToken\": \"{{ $('Webhook').item.json.body.customData['Private Integration Token'] }}\",\n      \"accountCompanyName\": \"{{ $('Webhook').item.json.body.customData['Account Company Name'] }}\",\n      \"eventIdId\": \"{{ $('Webhook').item.json.body.customData['Event ID ID'] }}\",\n      \"leadDispositionId\": \"{{ $('Webhook').item.json.body.customData['Lead Disposition ID'] }}\",\n      \"conversationIdId\": \"{{ $('Webhook').item.json.body.customData['Conversation ID ID'] }}\",\n      \"aiCallOutcomeId\": \"{{ $('Webhook').item.json.body.customData['AI Call Outcome ID'] }}\",\n      \"aiCallOutcomeReasonId\": \"{{ $('Webhook').item.json.body.customData['AI Call Outcome Reason ID'] }}\",\n      \"aiCallTranscriptId\": \"{{ $('Webhook').item.json.body.customData['AI Call Transcript ID'] }}\",\n      \"aiCallSummaryId\": \"{{ $('Webhook').item.json.body.customData['AI Call Summary ID'] }}\",\n      \"aiCallRecordingId\": \"{{ $('Webhook').item.json.body.customData['AI Call Recording ID'] }}\",\n      \"aiCallDurationId\": \"{{ $('Webhook').item.json.body.customData['AI Call Duration ID'] }}\",\n      \"aiCallCountId\": \"{{ $('Webhook').item.json.body.customData['AI Call Count ID'] }}\",\n      \"aiCallEndedReasonId\": \"{{ $('Webhook').item.json.body.customData['AI Call Ended Reason ID'] }}\",\n      \"aiCallAppointmentDateTimeId\": \"{{ $('Webhook').item.json.body.customData['AI Call Appointment DateTime ID'] }}\",\n      \"aiCallContactNameId\": \"{{ $('Webhook').item.json.body.customData['AI Call Contact Name ID'] }}\",\n      \"aiCallContactPhoneId\": \"{{ $('Webhook').item.json.body.customData['AI Call Contact Phone ID'] }}\",\n      \"aiCallContactEmailId\": \"{{ $('Webhook').item.json.body.customData['AI Call Contact Email ID'] }}\",\n      \"aiCallTimestampId\": \"{{ $('Webhook').item.json.body.customData['AI Call Timestamp ID'] }}\",\n      \"aiCallTypeId\": \"{{ $('Webhook').item.json.body.customData['AI Call Type ID'] }}\",\n      \"aiCallFollowUpDateTimeId\": \"{{ $('Webhook').item.json.body.customData['AI Call Follow Up DateTime ID'] }}\",\n      \"salesCalendarId\": \"{{ $('Webhook').item.json.body.customData['Sales Calendar ID'] }}\",\n      \"onboardingCalendarId\": \"{{ $('Webhook').item.json.body.customData['Onboarding Calendar ID'] }}\",\n      \"customerSuccessCalendarId\": \"{{ $('Webhook').item.json.body.customData['Customer Success Calendar ID'] }}\",\n      \"accountTimezone\": \"{{ $('Webhook').item.json.body.customData['Account Timezone'] }}\"\n    }\n}"
            },
            {
              "fieldId": "location_id",
              "fieldValue": "={{ $('Webhook').item.json.body.customData['Location ID'] }}"
            }
          ]
        }
      },
      "id": "c79fae06-dc24-4dc8-8081-16dd05541abc",
      "name": "Supabase5",
      "type": "n8n-nodes-base.supabase",
      "typeVersion": 1,
      "position": [
        -2220,
        2980
      ]
    },
    {
      "parameters": {
        "content": "# or this \"Get Row\" module\n",
        "height": 315.0169721291882,
        "width": 328.33172715573,
        "color": 5
      },
      "id": "35f8f763-f8ec-4b73-8630-036091a890de",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -1860,
        1800
      ]
    },
    {
      "parameters": {
        "jsCode": "// Get the metadata\nconst inputData = $(\"Get Metadata1\").first().json.metadata;\n\ntry {\n    // Parse the data if needed\n    const parsed = typeof inputData === 'string' ? JSON.parse(inputData) : inputData;\n    \n    // Instead of returning array of items, return a single object with all data\n    return [{\n        metadata: Object.entries(parsed.metadata || parsed || {}).reduce((acc, [key, value]) => {\n            acc[key] = value;\n            return acc;\n        }, {})\n    }];\n    \n} catch (error) {\n    console.log(\"Error processing:\", error);\n    return [{\n        error: JSON.stringify(error),\n        inputData: JSON.stringify(inputData)\n    }];\n}"
      },
      "id": "7908eeae-d7fb-4199-8da8-956f2cf92498",
      "name": "Format Metadata1",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -1660,
        1960
      ]
    },
    {
      "parameters": {
        "operation": "get",
        "tableId": "inbound_calls_phone_pit_locationid_metadata",
        "filters": {
          "conditions": [
            {
              "keyName": "phone",
              "keyValue": "={{ $('Webhook').item.json.body.to_number }}"
            }
          ]
        }
      },
      "id": "6a8072f1-e0c5-4b2e-8e75-a1e8e14b24fc",
      "name": "Get Metadata1",
      "type": "n8n-nodes-base.supabase",
      "typeVersion": 1,
      "position": [
        -1840,
        1960
      ]
    },
    {
      "parameters": {
        "url": "=https://services.leadconnectorhq.com/calendars/{{ $('Set Variables').item.json['Calendar ID'] }}/free-slots",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "startDate",
              "value": "={{ $json.startDate }}"
            },
            {
              "name": "endDate",
              "value": "={{ $json.endDate }}"
            },
            {
              "name": "timezone",
              "value": "={{ $('Webhook').item.json.body.args.timezone }}"
            }
          ]
        },
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept",
              "value": "application/json"
            },
            {
              "name": "Authorization",
              "value": "=Bearer {{ $('Set Variables').item.json.Authorization }}"
            },
            {
              "name": "Version",
              "value": "2021-04-15"
            }
          ]
        },
        "options": {
          "response": {
            "response": {
              "neverError": true,
              "responseFormat": "text",
              "outputPropertyName": "freeSlots"
            }
          }
        }
      },
      "id": "ac39eeee-55a2-4899-8ba9-21594608aae3",
      "name": "get free slots2",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -1220,
        520
      ],
      "retryOnFail": true,
      "onError": "continueRegularOutput"
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ JSON.stringify($('get free slots2').first().json.freeSlots) }}",
        "options": {}
      },
      "id": "ddea9187-d780-43d5-b6c3-f87def85137a",
      "name": "Alternative Slots Available2",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        -860,
        560
      ]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "=No availability for the requested date, please suggest a new date to check for availability. Ask user for a new date to check availability.",
        "options": {}
      },
      "id": "7644d59b-1d87-4c7a-bbf2-d7fe50d3b12d",
      "name": "No Alternative Slots Available2",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        -840,
        780
      ]
    },
    {
      "parameters": {
        "jsCode": "const appointmentDateTime = new Date($('Webhook').first().json.body.args.startDate); // ISO 8601 format\n\n// Start Date: Set to 12:00 AM of the appointment day\nconst startDate = new Date(\n  appointmentDateTime.getFullYear(),\n  appointmentDateTime.getMonth(),\n  appointmentDateTime.getDate()\n).getTime(); // Convert to Unix timestamp\n\n// End Date: Set to 11:59 PM of the appointment day\nconst endDate = new Date(\n  appointmentDateTime.getFullYear(),\n  appointmentDateTime.getMonth(),\n  appointmentDateTime.getDate(),\n  23, 59, 59\n).getTime(); // Convert to Unix timestamp\n\n// Return a single object\nreturn {\n  json: {\n    startDate,\n    endDate,\n  },\n};"
      },
      "id": "96e54764-f485-430c-bace-db97dc573ef6",
      "name": "Unix start & end date1",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -1420,
        520
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 1
          },
          "conditions": [
            {
              "id": "3eb820a9-1ce3-4a3a-8ad2-aacb55aa2720",
              "leftValue": "={{ $('get free slots2').first().json.freeSlots }}",
              "rightValue": "slots",
              "operator": {
                "type": "string",
                "operation": "contains"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "86e6950c-acf4-426e-80f4-1ea273d17ad3",
      "name": "Slots Available? 1",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.1,
      "position": [
        -1060,
        700
      ]
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "1798688f-e859-4d90-b4d0-63a8c7c0f765",
        "responseMode": "responseNode",
        "options": {}
      },
      "id": "3256cd77-47cf-4d56-b795-73a1d84a221d",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        -2140,
        260
      ]
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.body.name }}",
                    "rightValue": "schedule_appointment",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "schedule_appointment"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "796e7e54-befe-45e0-838a-b8e632430210",
                    "leftValue": "={{ $json.body.name }}",
                    "rightValue": "get_availability",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "get_availability"
            }
          ]
        },
        "options": {}
      },
      "id": "a5899fc0-b482-41e7-80cc-90ececa34656",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.2,
      "position": [
        -1860,
        260
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "b1257b77-8768-4640-bff9-e529360967e4",
              "name": "Location ID",
              "value": "=GHL Sub-Account Location ID",
              "type": "string"
            },
            {
              "id": "2b33ac83-26b0-45f8-81a2-4e49f7e4052a",
              "name": "Authorization",
              "value": "=PRIVATE INTEGRATION KEY",
              "type": "string"
            },
            {
              "id": "96bdbb04-6e4d-4180-aad1-867453b0d72c",
              "name": "Calendar ID",
              "value": "=Calendar ID",
              "type": "string"
            },
            {
              "id": "a870662c-774a-4257-8f16-9ee4d52812c9",
              "name": "Version",
              "value": "=2021-04-15",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "bfb8d849-4582-43d7-b304-8c15746e455f",
      "name": "Set Variables2",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -1640,
        520
      ]
    }
  ],
  "connections": {
    "Create Appointment": {
      "main": [
        [
          {
            "node": "Successful Booking?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "get free slots": {
      "main": [
        [
          {
            "node": "Slots Available? ",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Variables1": {
      "main": [
        [
          {
            "node": "Search GHL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search GHL": {
      "main": [
        [
          {
            "node": "Contact Exists",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Contact1": {
      "main": [
        [
          {
            "node": "Create Appointment1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Respond to Webhook8",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Appointment1": {
      "main": [
        [
          {
            "node": "Successful Booking?1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Successful Booking?": {
      "main": [
        [
          {
            "node": "Success Reply",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Unix start & end date",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Successful Booking?1": {
      "main": [
        [
          {
            "node": "Successful Booking",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Unix start&end Date",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Contact Exists": {
      "main": [
        [
          {
            "node": "Create Appointment",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Create Contact1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "get free slots1": {
      "main": [
        [
          {
            "node": "Available Slots?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Unix start&end Date": {
      "main": [
        [
          {
            "node": "get free slots1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Unix start & end date": {
      "main": [
        [
          {
            "node": "get free slots",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Slots Available? ": {
      "main": [
        [
          {
            "node": "Alternative Slots Available",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Alternative Slots Available",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Available Slots?": {
      "main": [
        [
          {
            "node": "Alternative Slots Available1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Alternative Slots Available1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Supabase1": {
      "main": [
        [
          {
            "node": "Supabase2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Supabase2": {
      "main": [
        [
          {
            "node": "Supabase3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Supabase3": {
      "main": [
        [
          {
            "node": "Supabase4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Supabase4": {
      "main": [
        [
          {
            "node": "Supabase5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Metadata1": {
      "main": [
        [
          {
            "node": "Format Metadata1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "get free slots2": {
      "main": [
        [
          {
            "node": "Slots Available? 1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Unix start & end date1": {
      "main": [
        [
          {
            "node": "get free slots2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Slots Available? 1": {
      "main": [
        [
          {
            "node": "Alternative Slots Available2",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Alternative Slots Available2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Set Variables1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Set Variables2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Variables2": {
      "main": [
        [
          {
            "node": "Unix start & end date1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "staticData": null,
  "meta": null,
  "versionId": "77dac929-0617-4a6e-ab9d-b9cb2dbb8cd8",
  "triggerCount": 0,
  "tags": [
    {
      "createdAt": "2025-02-21T17:46:54.494Z",
      "updatedAt": "2025-02-21T17:46:54.494Z",
      "id": "QZy10F3kJDG2Wxf5",
      "name": "LinkedIn"
    }
  ]
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

booking no duplicate. Uses httpRequest, supabase. Webhook trigger; 38 nodes.

Source: https://github.com/AndersonNascimentoDosSantos/n8n-workflow-backup/blob/main/booking-no-duplicate-etQC8Umz0pkphMmE.json — original creator credit. Request a take-down →

More Data & Sheets workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Data & Sheets

01-intake-storage. Uses airtable, supabase, stopAndError, httpRequest. Webhook trigger; 33 nodes.

Airtable, Supabase, Stop And Error +2
Data & Sheets

2. Refresh Pipedrive tokens. Uses stopAndError, stickyNote, supabase, httpRequest. Webhook trigger; 29 nodes.

Stop And Error, Supabase, HTTP Request
Data & Sheets

This workflow provides an OAuth 2.0 auth token refresh process for better control. Developers can utilize it as an alternative to n8n's built-in OAuth flow to achieve improved control and visibility.

Stop And Error, Supabase, HTTP Request
Data & Sheets

n8n-supabase-ai-pipeline. Uses supabase, httpRequest, postgres, readWriteFile. Webhook trigger; 25 nodes.

Supabase, HTTP Request, Postgres +1
Data & Sheets

Voxa W2 — Live Tools. Uses supabase, httpRequest. Webhook trigger; 22 nodes.

Supabase, HTTP Request