This system provides an AI-powered voice assistant for VAPI Health Clinic that handles appointment scheduling, rescheduling, cancellation, and general inquiries. The assistant, Amy, uses natural language processing to guide callers through appointment management workflows while maintaining a warm, professional, and empathetic tone.
The system consists of three main components:
- VAPI AI Assistant (
agent/assistant_config.json) - The conversational AI that handles voice interactions - n8n Workflow (
tools/scheduling/n8n_workflow.json) - Backend automation that processes scheduling requests - cal.com API - Calendar management system that stores and manages appointments
- The system enforces business hours (9 AM - 5 PM) and will not book outside these times
- The system uses number for booking (assumed +1 US numbers)
- Doctor availability is automatically enforced based on day of week
- All scheduling operations require proper event type selection based on day, doctor, and consultation type
- NOT Optimised for multiple booking records (ensure only 1 booking exists for rescheduling or cancellation for smooth operation)
- Cal.COM bookins WILL fill up after use, sanitize unused bookings / cancel to avoid availability fill up.
- Transfer calls goes to arbitrary US number
- Insurance collection details not required (added for realism)
Amy is only designed to:
- Answer patient questions and handle FAQs (extreamly general, denoted in prompt)
- Book, reschedule, and cancel healthcare appointments
- Route callers to appropriate human staff when needed (one destination)
- Maintain clinical professionalism without giving medical advice
- Business Hours: 9:00 AM - 5:00 PM, Sunday to Saturday (America/Los_Angeles)
- One question at a time: Asks questions sequentially and waits for responses
- Natural conversation: Never mentions "functions", "tools", or technical terms
- Guardrails: Handles inappropriate questions and medical emergencies appropriately
All scheduling operations are handled through five main tools that connect to the n8n workflow:
Purpose: Check available appointment slots
Parameters:
requestedTime(required): Requested time in formatyyyy-mm-ddTHH:mm:ss(e.g.,2025-07-04T11:00:00)EventTypeID(required): One of the four event type IDsEventTypeSlug(required): One of the four event type slugstimeZone(optional): Defaults toAmerica/Los_Angeles
Logic (from n8n workflow):
- Queries cal.com API for available slots around the requested time
- If exact match found → returns confirmation message
- If no exact match but slots available → returns alternative times
- If no slots available → expands search window (±2 hours) and retries
- If still no slots → suggests alternative days
Purpose: Create a new appointment
Required Parameters:
firstName,lastName: Patient namerequestedTime: Selected appointment timeeventTypeID,eventTypeSlug: Event type identifiers
Optional Parameters:
phone: Patient phone number (normalized to E.164 format)birthDate: Date of birthreason: Reason for visitinsuranceProvider,insuranceID: Insurance information
Logic (from n8n workflow):
- Normalizes phone number to E.164 format (+1XXXXXXXXXX)
- Creates booking via cal.com v2 API
- Updates/creates patient record in n8n DataTable
- Returns success confirmation with booking details
Purpose: Retrieve existing appointment by patient details
Required Parameters:
phone: Patient phone number
Optional Parameters:
name: Patient name (for verification)
Logic (from n8n workflow):
- Normalizes phone number to E.164 format
- Queries n8n DataTable for appointment by phone number
- If found → retrieves appointment UID from cal.com
- Returns appointment details (date, time, UID)
Purpose: Change an existing appointment to a new time
Required Parameters:
bookinguid: Unique identifier fromgetCalendarVAPIHealth
Optional Parameters:
start: New start time in ISO 8601 UTC format
Logic (from n8n workflow):
- Calls cal.com v2 API to reschedule booking
- Updates appointment time in n8n DataTable
- Returns success confirmation with new appointment details
Purpose: Cancel an existing appointment
Required Parameters:
phone: Patient phone number
Optional Parameters:
name: Patient name (for verification)
Logic (from n8n workflow):
- Retrieves appointment using
getCalendarVAPIHealthlogic - Cancels booking via cal.com v2 API
- Optionally clears appointment data from DataTable
- Returns cancellation confirmation
The system supports 4 event types in cal.com, mapped to specific doctors and consultation types:
| Event Type ID | Event Type Slug | Doctor | Consultation Type | Available Days |
|---|---|---|---|---|
3954317 |
dr-chan-clinic-30-minute |
Dr. Chan | In-person | Sunday, Wednesday, Saturday |
3954310 |
dr-wong-clinic-30-minute |
Dr. Wong | In-person | Monday, Tuesday, Thursday, Friday |
3954311 |
dr-chan-telehealth-30-minute |
Dr. Chan | Telehealth | Sunday, Wednesday, Saturday |
3954306 |
dr-wong-telehealth-30-minute |
Dr. Wong | Telehealth | Monday, Tuesday, Thursday, Friday |
Dr. Chan
- Days: Sunday, Wednesday, Saturday
- Hours: 9:00 AM - 5:00 PM
- Timezone: America/Los_Angeles
Dr. Wong
- Days: Monday, Tuesday, Thursday, Friday
- Hours: 9:00 AM - 5:00 PM
- Timezone: America/Los_Angeles
The AI assistant automatically selects the correct event type based on:
- Consultation type (in-person vs telehealth)
- Requested day of week
- Doctor preference (if specified)
Example:
- Caller requests: "Telehealth appointment on Monday"
- System selects:
3954306/dr-wong-telehealth-30-minute(Dr. Wong, Telehealth, Monday)
The n8n workflow (tools/scheduling/n8n_workflow.json) handles all backend processing:
- URL:
https://vapiai.app.n8n.cloud/webhook/calendar-book12 - Method: POST
- Receives tool calls from VAPI AI assistant
-
Request Validation
- Validates incoming webhook is a tool-call request
- Routes to appropriate handler based on tool name
-
Tool Routing (Switch Node)
- Routes to different flows based on tool name:
checkCalendarVAPIHealth→ Availability checking flowbookCalendarVAPIHealth→ Booking flowgetCalendarVAPIHealth→ Retrieval flowcancelCalendarVAPIHealth→ Cancellation flowrescheduleCalendarVAPIHealth→ Rescheduling flow
- Routes to different flows based on tool name:
-
Phone Number Normalization
- Converts various phone formats to E.164 (+1XXXXXXXXXX)
- Handles US numbers (10 digits) and international format (11 digits with country code)
-
DataTable Integration
- Stores patient information (name, phone, DOB, appointment UID, appointment time)
- Uses phone number (E.164) as primary key
- Supports upsert operations for patient records
-
cal.com API Integration
- v1 API: Used for checking availability (
/v1/slots) - v2 API: Used for booking, rescheduling, and cancellation (
/v2/bookings) - Handles timezone conversions (America/Los_Angeles)
- Manages event type selection based on day/doctor/consultation type
- v1 API: Used for checking availability (
-
Error Handling
- Returns appropriate error messages for failed operations
- Handles missing appointments gracefully
- Provides fallback responses for technical issues
- Intent Detection: Caller expresses desire to book appointment
- Information Collection: Amy collects:
- First name, last name
- Date of birth
- Phone number
- Reason for visit
- Insurance information (optional)
- Consultation type (in-person/telehealth)
- Preferred time/day
- Doctor preference (optional)
- Availability Check: Calls
checkCalendarVAPIHealthwith appropriate event type - Slot Selection: Presents 2-4 available options to caller
- Confirmation: Confirms appointment details
- Booking: Calls
bookCalendarVAPIHealthto create appointment - Confirmation: Provides booking confirmation with details
- Appointment Retrieval: Uses
getCalendarVAPIHealthto find existing appointment - Verification: Confirms appointment details with caller
- New Time Collection: Asks for preferred new time
- Availability Check: Checks availability for new time
- Rescheduling: Calls
rescheduleCalendarVAPIHealthwith booking UID - Confirmation: Confirms new appointment time
- Appointment Retrieval: Uses
getCalendarVAPIHealthto find appointment - Verification: Confirms appointment to cancel
- Cancellation: Calls
cancelCalendarVAPIHealth - Rebooking Offer: Optionally offers to book new appointment
Patient and appointment data is stored in:
- cal.com: Primary source of truth for appointments
- n8n DataTable: Patient records with appointment references
- Fields:
first_name,last_name,phone,dob,appointment_uid,appointment_time
- Fields:
- All appointments are managed in America/Los_Angeles timezone
- The system converts between UTC (for API calls) and Pacific Time (for user communication)
- Business hours are enforced: 9:00 AM - 5:00 PM Pacific Time
The system handles various error scenarios:
- No appointment found: Offers to book new appointment
- Time slot unavailable: Suggests alternative times
- Technical errors: Provides user-friendly error messages and fallback options
- Invalid phone numbers: Normalizes or requests clarification
- Phone numbers are normalized and stored in E.164 format
- Patient data is stored securely in n8n DataTable
- All API communications use secure HTTPS endpoints
- HIPAA compliance considerations are built into the system design
assistant.json: VAPI AI assistant configuration with system prompttools/scheduling/n8n_workflow.json: n8n workflow definitiontools/scheduling/*.json: Individual tool definitions for VAPI