{
  "name": "Book, manage, and check appointments using Vapi and Google Calendar",
  "nodes": [
    {
      "id": "e7503d57-8408-4b88-bcc7-52b8b9a0751f",
      "name": "Book Appointment Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        2608,
        2432
      ]
    },
    {
      "id": "ffaa0c7e-ebe5-4794-9b08-7772630ab556",
      "name": "Extract Booking Data",
      "type": "n8n-nodes-base.set",
      "position": [
        2832,
        2432
      ]
    },
    {
      "id": "93cabadc-fc25-4779-9c59-f63662518615",
      "name": "Validate Required Fields",
      "type": "n8n-nodes-base.if",
      "position": [
        3056,
        2432
      ]
    },
    {
      "id": "9b26b185-7285-4ed1-a47b-21046b0052c4",
      "name": "Respond - Validation Error",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        3664,
        2528
      ]
    },
    {
      "id": "b5dc67a8-f6d6-4ff5-82d1-9345c98cb5c8",
      "name": "Create Calendar Event",
      "type": "n8n-nodes-base.googleCalendar",
      "position": [
        3248,
        2272
      ]
    },
    {
      "id": "948e3ab6-bddc-432f-a918-c03d41c4836f",
      "name": "Respond - Booking Success",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        3664,
        2272
      ]
    },
    {
      "id": "f4f3b539-ac7b-471d-bbb9-8d35dc9fc1df",
      "name": "Format Booking Success Response",
      "type": "n8n-nodes-base.code",
      "position": [
        3456,
        2272
      ]
    },
    {
      "id": "d06933a5-aa49-462d-bc71-31e14cd39170",
      "name": "Format Validation Error Response",
      "type": "n8n-nodes-base.code",
      "position": [
        3440,
        2528
      ]
    },
    {
      "id": "9b9c9b54-8564-42b2-bedc-c08faceb61b9",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2128,
        2416
      ],
      "parameters": {
        "width": 284,
        "height": 244,
        "content": "## Tool 2: Book Appointment\n\nReceives booking data from Vapi, validates required fields, creates Google Calendar event, and returns formatted response."
      }
    },
    {
      "id": "8fa0a809-d354-4a68-b33f-baff4d2196e6",
      "name": "Get Calendar Events for Date",
      "type": "n8n-nodes-base.googleCalendar",
      "position": [
        3056,
        1456
      ]
    },
    {
      "id": "76b97cbd-354b-4793-a106-a1f706d1cd68",
      "name": "Check Availability Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        2608,
        1456
      ]
    },
    {
      "id": "3dd18a71-b6fc-4ae9-a3c6-842a8b618b23",
      "name": "Extract Availability Request",
      "type": "n8n-nodes-base.set",
      "position": [
        2832,
        1456
      ]
    },
    {
      "id": "324e6bdb-55bb-44d7-9efc-8a727ca8bc86",
      "name": "Check Time Slot Availability",
      "type": "n8n-nodes-base.if",
      "position": [
        3280,
        1456
      ]
    },
    {
      "id": "7e25e200-ae98-412b-92cd-29d9267a5be3",
      "name": "Respond - Time Available",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        3728,
        1552
      ]
    },
    {
      "id": "3aab7fb2-6089-49a8-9ceb-7a93febfed13",
      "name": "Respond - Time Unavailable",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        3728,
        1360
      ]
    },
    {
      "id": "b168952e-55aa-4584-8558-bda1f5e28c63",
      "name": "Format Unavailable Time Response",
      "type": "n8n-nodes-base.code",
      "position": [
        3504,
        1360
      ]
    },
    {
      "id": "ed8ce086-844b-4207-888e-7f5def845232",
      "name": "Format Available Time Response",
      "type": "n8n-nodes-base.code",
      "position": [
        3504,
        1552
      ]
    },
    {
      "id": "92eec412-0717-40cc-bc2e-456e798ab190",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2080,
        1472
      ],
      "parameters": {
        "width": 300,
        "height": 212,
        "content": "## Tool 1: Check Availability\n\nQueries Google Calendar for requested date, checks if time slot is available, and suggests alternatives if booked."
      }
    },
    {
      "id": "c57866e7-e8b8-4817-b664-54bea38622e8",
      "name": "Route by Action Type",
      "type": "n8n-nodes-base.switch",
      "position": [
        2992,
        3488
      ]
    },
    {
      "id": "43ad4f84-5636-4ce7-833f-db74fb6cad01",
      "name": "Update Calendar Event",
      "type": "n8n-nodes-base.googleCalendar",
      "position": [
        3440,
        3312
      ]
    },
    {
      "id": "be76caef-429e-47da-8a3a-172608ef38a9",
      "name": "Find Appointment to Cancel",
      "type": "n8n-nodes-base.googleCalendar",
      "position": [
        3216,
        3584
      ]
    },
    {
      "id": "6815d0a0-b874-4f19-a46f-db8a40738685",
      "name": "Delete Calendar Event",
      "type": "n8n-nodes-base.googleCalendar",
      "position": [
        3440,
        3584
      ]
    },
    {
      "id": "7510b91c-2635-47e4-b8bc-1191c5f47e01",
      "name": "Manage Appointment Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        2544,
        3488
      ]
    },
    {
      "id": "98b1dd20-fe60-476c-bbc3-518dd66aaf5a",
      "name": "Extract Appointment Management Data",
      "type": "n8n-nodes-base.set",
      "position": [
        2768,
        3488
      ]
    },
    {
      "id": "44b36764-836d-4997-8a09-27667a51c482",
      "name": "Find Appointment to Update",
      "type": "n8n-nodes-base.googleCalendar",
      "position": [
        3216,
        3312
      ]
    },
    {
      "id": "1d4de4a8-3e05-48fb-a598-be2b55f1010e",
      "name": "Respond - Reschedule Success",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        3888,
        3312
      ]
    },
    {
      "id": "c3cea1dd-973e-47c9-887f-6f9580e8522b",
      "name": "Respond - Cancellation Success",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        3888,
        3584
      ]
    },
    {
      "id": "df6347f3-3fb2-44d0-9f21-79a67d233d3a",
      "name": "Format Cancellation Success Response",
      "type": "n8n-nodes-base.code",
      "position": [
        3664,
        3584
      ]
    },
    {
      "id": "02444c73-db46-4bf3-a1d7-13952e602a8c",
      "name": "Format Reschedule Success Response",
      "type": "n8n-nodes-base.code",
      "position": [
        3664,
        3312
      ]
    },
    {
      "id": "f49778a4-e30d-4b02-8ac8-dfc6497d7fe9",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2016,
        3376
      ],
      "parameters": {
        "width": 300,
        "height": 260,
        "content": "## Tool 3: Manage Appointments\n\nHandles cancellations and rescheduling. Routes by action type, finds existing appointment, then updates or deletes calendar event."
      }
    },
    {
      "id": "9501e517-7cb6-47b6-a219-21778d2d3f88",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        5024,
        1520
      ],
      "parameters": {
        "width": 1232,
        "height": 1904,
        "content": "# VAPI VOICE ASSISTANT PROMPT\n\n### Booking Appointments\nBook the appointment using the **bookAppointment** tool.\nOnce the customer has confirmed their preferred date and time slot, collect **all requi"
      }
    },
    {
      "id": "389acfc3-2633-47c1-92d2-b715bce1d48b",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        1840
      ],
      "parameters": {
        "width": 976,
        "height": 864,
        "content": "# Book Appointments using Vapi and Google Calendar\nUse this workflow to book, cancel, or reschedule appointments using Vapi and Google Calendar\n\n## How it works\nThe Check Availability workflow checks "
      }
    },
    {
      "id": "c8da4a29-3b68-46c1-b8b8-067c53412556",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3440,
        1168
      ],
      "parameters": {
        "width": 528,
        "height": 560,
        "content": "The top code node pulls all events, checks that time and data requested does not overlap with any events, returns time periods as unavailable and then suggests 3 alternate times closest to the request"
      }
    },
    {
      "id": "c7ec83f6-17a4-4a70-baf9-1a774c16aeb5",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3376,
        2144
      ],
      "parameters": {
        "width": 496,
        "height": 592,
        "content": "The top and bottom code node format the results in the required vapi response format"
      }
    },
    {
      "id": "4b9ddc95-13f0-4b08-b577-dcf84f46ead8",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3600,
        3168
      ],
      "parameters": {
        "width": 512,
        "height": 592,
        "content": "The code nodes format results in the required vapi response format for easy debugging on vapi terminal"
      }
    }
  ],
  "connections": {
    "Extract Booking Data": {
      "main": [
        [
          {
            "node": "Validate Required Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route by Action Type": {
      "main": [
        [
          {
            "node": "Find Appointment to Update",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Find Appointment to Cancel",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Calendar Event": {
      "main": [
        [
          {
            "node": "Format Booking Success Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Delete Calendar Event": {
      "main": [
        [
          {
            "node": "Format Cancellation Success Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Calendar Event": {
      "main": [
        [
          {
            "node": "Format Reschedule Success Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Book Appointment Webhook": {
      "main": [
        [
          {
            "node": "Extract Booking Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate Required Fields": {
      "main": [
        [
          {
            "node": "Create Calendar Event",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Format Validation Error Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Availability Webhook": {
      "main": [
        [
          {
            "node": "Extract Availability Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Find Appointment to Cancel": {
      "main": [
        [
          {
            "node": "Delete Calendar Event",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Find Appointment to Update": {
      "main": [
        [
          {
            "node": "Update Calendar Event",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Manage Appointment Webhook": {
      "main": [
        [
          {
            "node": "Extract Appointment Management Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Time Slot Availability": {
      "main": [
        [
          {
            "node": "Format Unavailable Time Response",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Format Available Time Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Availability Request": {
      "main": [
        [
          {
            "node": "Get Calendar Events for Date",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Calendar Events for Date": {
      "main": [
        [
          {
            "node": "Check Time Slot Availability",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Available Time Response": {
      "main": [
        [
          {
            "node": "Respond - Time Available",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Booking Success Response": {
      "main": [
        [
          {
            "node": "Respond - Booking Success",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Unavailable Time Response": {
      "main": [
        [
          {
            "node": "Respond - Time Unavailable",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Validation Error Response": {
      "main": [
        [
          {
            "node": "Respond - Validation Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Reschedule Success Response": {
      "main": [
        [
          {
            "node": "Respond - Reschedule Success",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Appointment Management Data": {
      "main": [
        [
          {
            "node": "Route by Action Type",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Cancellation Success Response": {
      "main": [
        [
          {
            "node": "Respond - Cancellation Success",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}