{
  "id": "GwOvGy8lq-3fM5KQlSSLZ",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Automate clinic appointment booking with WhatsApp, Google Meet and Google Calendar",
  "tags": [],
  "nodes": [
    {
      "id": "caa3181a-ae0e-40ac-8c5f-9f6dfe468f2e",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4464,
        1680
      ],
      "parameters": {
        "width": 480,
        "height": 896,
        "content": "## Automate clinic appointment booking with WhatsApp, Google Meet and Google Calendar\n\n### How it works\n\nThis workflow receives a clinic appointment booking request, extracts patient and appointment details, and routes the booking based on whether it is an online or offline consultation. It creates the appropriate Google Calendar event, captures the event details such as the Meet link when applicable, then sends confirmations to the patient by email and WhatsApp. It also notifies the doctor, waits until the reminder window, and sends the patient a follow-up reminder by email and WhatsApp.\n\n### Setup steps\n\n- Configure the webhook endpoint and ensure incoming requests include patient_name, patient_email, patient_phone, appointment_date, and the consultation type used by the IF condition.\n- Connect Google Calendar credentials and set the target clinic calendar, event duration, online meeting/Google Meet settings, and offline appointment location as needed.\n- Connect Gmail credentials for patient confirmations, doctor notifications, and reminder emails.\n- Configure Twilio credentials with WhatsApp sender details and verify that patient phone numbers are formatted correctly for WhatsApp delivery.\n- Review the Wait node timing so reminders are sent at the intended interval before the appointment.\n\n### Customization\n\nYou can customize the online/offline branching condition, email and WhatsApp message templates, doctor recipient address, appointment duration, clinic location, and reminder timing."
      },
      "typeVersion": 1
    },
    {
      "id": "47987def-a9e6-4c19-8589-1abc8f635c31",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        5024,
        1856
      ],
      "parameters": {
        "color": 7,
        "width": 736,
        "height": 320,
        "content": "## Receive and route booking\n\nCaptures the incoming booking request, normalizes key patient and appointment fields, generates booking data, and decides whether the appointment is online or offline."
      },
      "typeVersion": 1
    },
    {
      "id": "50d7b181-06a1-496c-89eb-68b0c4ad0f7b",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        5808,
        1680
      ],
      "parameters": {
        "color": 7,
        "width": 416,
        "height": 336,
        "content": "## Create online appointment\n\nCreates the online Google Calendar event and stores the resulting consultation details, including the Meet link and patient contact fields."
      },
      "typeVersion": 1
    },
    {
      "id": "6dbb180c-208e-4043-b2d3-e36ef039d0b2",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        5808,
        2048
      ],
      "parameters": {
        "color": 7,
        "width": 416,
        "height": 320,
        "content": "## Create offline appointment\n\nCreates the offline Google Calendar event and stores the resulting appointment details along with the patient contact fields."
      },
      "typeVersion": 1
    },
    {
      "id": "6e126d68-ef0d-4c7e-a539-aeea72ef632f",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        6256,
        1888
      ],
      "parameters": {
        "color": 7,
        "width": 656,
        "height": 304,
        "content": "## Confirm patient booking\n\nMerges the online and offline branches, then sends the patient confirmation details through email and WhatsApp."
      },
      "typeVersion": 1
    },
    {
      "id": "85febc05-9b75-412b-a2e8-1b076bff33b8",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        7072,
        1856
      ],
      "parameters": {
        "color": 7,
        "width": 416,
        "height": 320,
        "content": "## Notify doctor and wait\n\nSends the appointment notification to the doctor, then pauses the workflow until the reminder window is reached."
      },
      "typeVersion": 1
    },
    {
      "id": "bd073a0b-8a49-47d8-9691-7813a9e97caf",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        7520,
        1888
      ],
      "parameters": {
        "color": 7,
        "width": 416,
        "height": 304,
        "content": "## Send patient reminders\n\nSends the scheduled 24-hour reminder to the patient by email and WhatsApp."
      },
      "typeVersion": 1
    },
    {
      "id": "43bc13ff-e654-4ec4-b10c-2ee650dc8342",
      "name": "Receive Clinic Booking",
      "type": "n8n-nodes-base.webhook",
      "position": [
        5072,
        2016
      ],
      "parameters": {
        "path": "clinic-booking",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2
    },
    {
      "id": "be2ce879-85bc-4160-92e1-3390179a19bf",
      "name": "Extract Booking Details",
      "type": "n8n-nodes-base.set",
      "position": [
        5296,
        2016
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "55d6fa7c-1311-47d8-ae4a-75bcb142e910",
      "name": "Check Online Consultation",
      "type": "n8n-nodes-base.if",
      "position": [
        5616,
        2016
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "leftValue": "",
            "caseSensitive": false,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "condition-online",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.consultation_type }}",
              "rightValue": "online"
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "928ccf51-e9dd-4441-b301-0f81637b27db",
      "name": "Schedule Online Appointment",
      "type": "n8n-nodes-base.googleCalendar",
      "position": [
        5856,
        1856
      ],
      "parameters": {
        "end": "={{ DateTime.fromISO($('Extract Booking Details').item.json.appointment_datetime).plus({hours: 1}).toISO() }}",
        "start": "={{ $('Extract Booking Details').item.json.appointment_datetime }}",
        "calendar": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_DOCTOR_CALENDAR_ID"
        },
        "additionalFields": {
          "summary": "=\ud83c\udfe5 Online Consultation \u2014 {{ $('Extract Booking Details').item.json.patient_name }}",
          "attendees": "={{ $('Extract Booking Details').item.json.patient_email }}",
          "description": "=Booking ID: {{ $('Extract Booking Details').item.json.booking_id }}\nPatient: {{ $('Extract Booking Details').item.json.patient_name }}\nEmail: {{ $('Extract Booking Details').item.json.patient_email }}\nPhone: {{ $('Extract Booking Details').item.json.patient_phone }}\nType: Online Consultation"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "357ce959-eeb2-4140-b631-369bc1045557",
      "name": "Prepare Online Event Details",
      "type": "n8n-nodes-base.set",
      "position": [
        6080,
        1856
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "9656825d-227a-46be-a284-150792fb6088",
      "name": "Schedule Offline Appointment",
      "type": "n8n-nodes-base.googleCalendar",
      "position": [
        5856,
        2208
      ],
      "parameters": {
        "end": "={{ DateTime.fromISO($('Extract Booking Details').item.json.appointment_datetime).plus({hours: 1}).toISO() }}",
        "start": "={{ $('Extract Booking Details').item.json.appointment_datetime }}",
        "calendar": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_DOCTOR_CALENDAR_ID"
        },
        "additionalFields": {
          "summary": "=\ud83c\udfe5 In-Person Consultation \u2014 {{ $('Extract Booking Details').item.json.patient_name }}",
          "location": "YOUR_CLINIC_ADDRESS",
          "attendees": "={{ $('Extract Booking Details').item.json.patient_email }}",
          "description": "=Booking ID: {{ $('Extract Booking Details').item.json.booking_id }}\nPatient: {{ $('Extract Booking Details').item.json.patient_name }}\nEmail: {{ $('Extract Booking Details').item.json.patient_email }}\nPhone: {{ $('Extract Booking Details').item.json.patient_phone }}\nType: In-Person\nLocation: YOUR_CLINIC_ADDRESS"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "7cbc37c9-c954-4b35-9bf7-df9188719159",
      "name": "Prepare Offline Event Details",
      "type": "n8n-nodes-base.set",
      "position": [
        6080,
        2208
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "28344bc6-5d9b-4eea-8c4e-8718e979fcf8",
      "name": "Merge Event Branches",
      "type": "n8n-nodes-base.merge",
      "position": [
        6304,
        2016
      ],
      "parameters": {
        "mode": "chooseBranch",
        "output": "input1"
      },
      "typeVersion": 3
    },
    {
      "id": "846ee337-f849-4d50-a25b-846d9c681c4e",
      "name": "Email Confirmation to Patient",
      "type": "n8n-nodes-base.gmail",
      "position": [
        6544,
        2016
      ],
      "parameters": {
        "sendTo": "={{ $json.patient_email }}",
        "message": "=Dear {{ $json.patient_name }},\n\nYour appointment is confirmed!\n\n\ud83d\udccb Booking ID: {{ $json.booking_id }}\n\ud83d\udcc5 Date: {{ $json.appointment_date }}\n\u23f0 Time: {{ $json.appointment_time }}\n\ud83c\udfe5 Type: {{ $json.consultation_type }} Consultation\n\ud83d\udccd {{ $json.consultation_type == 'Online' ? 'Google Meet: ' + $json.meet_link : 'Location: ' + $json.meet_link }}\n\nYou will receive a reminder 24 hours before your appointment.\n\nBest regards,\nThe Medical Team",
        "options": {},
        "subject": "=\u2705 Appointment Confirmed \u2014 Booking ID: {{ $json.booking_id }}"
      },
      "typeVersion": 2
    },
    {
      "id": "0a4e0962-b9a4-43b9-8e42-65d0a413fb1e",
      "name": "WhatsApp Confirmation to Patient",
      "type": "n8n-nodes-base.twilio",
      "position": [
        6768,
        2016
      ],
      "parameters": {
        "options": {},
        "operation": "create"
      },
      "typeVersion": 1
    },
    {
      "id": "859c4d96-ac03-4021-b584-6e28e1334f8b",
      "name": "Email Notification to Doctor",
      "type": "n8n-nodes-base.gmail",
      "position": [
        7136,
        2016
      ],
      "parameters": {
        "sendTo": "YOUR_DOCTOR_EMAIL",
        "message": "=New appointment confirmed:\n\n\ud83d\udccb Booking ID: {{ $('Merge Event Branches').item.json.booking_id }}\n\ud83d\udc64 Patient: {{ $('Merge Event Branches').item.json.patient_name }}\n\ud83d\udce7 Email: {{ $('Merge Event Branches').item.json.patient_email }}\n\ud83d\udcde Phone: {{ $('Merge Event Branches').item.json.patient_phone }}\n\ud83d\udcc5 Date: {{ $('Merge Event Branches').item.json.appointment_date }}\n\u23f0 Time: {{ $('Merge Event Branches').item.json.appointment_time }}\n\ud83c\udfe5 Type: {{ $('Merge Event Branches').item.json.consultation_type }} Consultation\n\ud83d\udccd {{ $('Merge Event Branches').item.json.meet_link }}\n\nCalendar event created automatically.",
        "options": {},
        "subject": "=\ud83c\udfe5 New Appointment \u2014 {{ $('Merge Event Branches').item.json.patient_name }}"
      },
      "typeVersion": 2
    },
    {
      "id": "db5e8908-6a67-4f03-8a7c-6a4b4ccb138c",
      "name": "Wait 23 Hours",
      "type": "n8n-nodes-base.wait",
      "position": [
        7344,
        2016
      ],
      "parameters": {
        "amount": 23
      },
      "typeVersion": 1
    },
    {
      "id": "2c470999-416e-4ee8-842c-8c101fc7e565",
      "name": "Email Patient 24hr Reminder",
      "type": "n8n-nodes-base.gmail",
      "position": [
        7568,
        2016
      ],
      "parameters": {
        "sendTo": "={{ $('Merge Event Branches').item.json.patient_email }}",
        "message": "=Dear {{ $('Merge Event Branches').item.json.patient_name }},\n\nYour appointment is tomorrow.\n\n\ud83d\udccb Booking ID: {{ $('Merge Event Branches').item.json.booking_id }}\n\ud83d\udcc5 Date: {{ $('Merge Event Branches').item.json.appointment_date }}\n\u23f0 Time: {{ $('Merge Event Branches').item.json.appointment_time }}\n\ud83c\udfe5 Type: {{ $('Merge Event Branches').item.json.consultation_type }} Consultation\n\ud83d\udccd {{ $('Merge Event Branches').item.json.meet_link }}\n\nPlease be available at the scheduled time.\n\nBest regards,\nThe Medical Team",
        "options": {},
        "subject": "=\u23f0 Reminder \u2014 Appointment Tomorrow: {{ $('Merge Event Branches').item.json.appointment_date }}"
      },
      "typeVersion": 2
    },
    {
      "id": "166ee64e-ac85-4471-961c-d9c60e5e0f80",
      "name": "WhatsApp 24hr Reminder to Patient",
      "type": "n8n-nodes-base.twilio",
      "position": [
        7792,
        2016
      ],
      "parameters": {
        "options": {},
        "operation": "create"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "",
  "connections": {
    "Wait 23 Hours": {
      "main": [
        [
          {
            "node": "Email Patient 24hr Reminder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Event Branches": {
      "main": [
        [
          {
            "node": "Email Confirmation to Patient",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Receive Clinic Booking": {
      "main": [
        [
          {
            "node": "Extract Booking Details",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Booking Details": {
      "main": [
        [
          {
            "node": "Check Online Consultation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Online Consultation": {
      "main": [
        [
          {
            "node": "Schedule Online Appointment",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Schedule Offline Appointment",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email Patient 24hr Reminder": {
      "main": [
        [
          {
            "node": "WhatsApp 24hr Reminder to Patient",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Online Appointment": {
      "main": [
        [
          {
            "node": "Prepare Online Event Details",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email Notification to Doctor": {
      "main": [
        [
          {
            "node": "Wait 23 Hours",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Online Event Details": {
      "main": [
        [
          {
            "node": "Merge Event Branches",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Offline Appointment": {
      "main": [
        [
          {
            "node": "Prepare Offline Event Details",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email Confirmation to Patient": {
      "main": [
        [
          {
            "node": "WhatsApp Confirmation to Patient",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Offline Event Details": {
      "main": [
        [
          {
            "node": "Merge Event Branches",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "WhatsApp Confirmation to Patient": {
      "main": [
        [
          {
            "node": "Email Notification to Doctor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}