|
| 1 | +--- |
| 2 | +title: Appointment scheduling assistant |
| 3 | +subtitle: Build an AI receptionist that books, reschedules, and cancels appointments using Assistants and tools |
| 4 | +slug: assistants/examples/appointment-scheduling |
| 5 | +description: Build a voice AI appointment scheduling assistant with Google Calendar integration, availability checking, and automated confirmations using Vapi Assistants. |
| 6 | +--- |
| 7 | + |
| 8 | +## Overview |
| 9 | + |
| 10 | +Build an AI-powered appointment scheduling assistant that handles inbound calls for booking, rescheduling, and canceling appointments. This approach uses a single Assistant with tools for calendar availability, customer lookups, and confirmations. |
| 11 | + |
| 12 | +**Assistant Capabilities:** |
| 13 | +* Real-time availability checks and booking |
| 14 | +* Reschedule and cancel with confirmation |
| 15 | +* Customer verification and data lookups |
| 16 | +* SMS/email confirmations via tools |
| 17 | + |
| 18 | +**What You'll Build:** |
| 19 | +* An assistant with a focused prompt for scheduling flows |
| 20 | +* Tools for calendar availability and booking |
| 21 | +* Optional CSV knowledge bases for customers/services |
| 22 | +* A phone number attached to your assistant |
| 23 | + |
| 24 | +## Prerequisites |
| 25 | + |
| 26 | +* A [Vapi account](https://dashboard.vapi.ai/) |
| 27 | +* Google Calendar or a scheduling backend |
| 28 | + |
| 29 | +## 1. Prepare data (optional) |
| 30 | + |
| 31 | +Use sample CSVs for customers, services, and appointments during development. |
| 32 | + |
| 33 | +<Steps> |
| 34 | + <Step title="Download sample spreadsheets"> |
| 35 | + <div className="flex gap-2"> |
| 36 | + <Download src="../../static/spreadsheets/appointment-scheduling/services.csv"> |
| 37 | + <Button intent="primary">Download services.csv</Button> |
| 38 | + </Download> |
| 39 | + <Download src="../../static/spreadsheets/appointment-scheduling/customers.csv"> |
| 40 | + <Button intent="primary">Download customers.csv</Button> |
| 41 | + </Download> |
| 42 | + <Download src="../../static/spreadsheets/appointment-scheduling/appointments.csv"> |
| 43 | + <Button intent="primary">Download appointments.csv</Button> |
| 44 | + </Download> |
| 45 | + </div> |
| 46 | + </Step> |
| 47 | + <Step title="Upload files (optional)"> |
| 48 | + <Tabs> |
| 49 | + <Tab title="Dashboard"> |
| 50 | + 1. Open your [Vapi Dashboard](https://dashboard.vapi.ai) → Files |
| 51 | + 2. Upload the three CSVs and note their file IDs |
| 52 | + |
| 53 | + <video autoPlay loop muted src="../../static/videos/upload-files.mp4" type="video/mp4" style={{ aspectRatio: '16 / 9', width: '100%' }} /> |
| 54 | + </Tab> |
| 55 | + <Tab title="TypeScript (Server SDK)"> |
| 56 | + ```typescript |
| 57 | + import { VapiClient } from "@vapi-ai/server-sdk"; |
| 58 | + import fs from "fs"; |
| 59 | + |
| 60 | + const vapi = new VapiClient({ token: process.env.VAPI_API_KEY! }); |
| 61 | + |
| 62 | + async function upload(file: string) { |
| 63 | + const res = await vapi.files.create({ file: fs.createReadStream(file) }); |
| 64 | + console.log(file, res.id); |
| 65 | + return res.id; |
| 66 | + } |
| 67 | + |
| 68 | + const servicesFileId = await upload("services.csv"); |
| 69 | + const customersFileId = await upload("customers.csv"); |
| 70 | + const appointmentsFileId = await upload("appointments.csv"); |
| 71 | + ``` |
| 72 | + </Tab> |
| 73 | + <Tab title="Python (Server SDK)"> |
| 74 | + ```python |
| 75 | + import requests, os |
| 76 | + |
| 77 | + def upload(path: str): |
| 78 | + r = requests.post( |
| 79 | + "https://api.vapi.ai/file", |
| 80 | + headers={"Authorization": f"Bearer {os.getenv('VAPI_API_KEY')}"}, |
| 81 | + files={"file": open(path, "rb")}, |
| 82 | + ) |
| 83 | + r.raise_for_status() |
| 84 | + print(path, r.json()["id"]) |
| 85 | + return r.json()["id"] |
| 86 | + |
| 87 | + services_file_id = upload("services.csv") |
| 88 | + customers_file_id = upload("customers.csv") |
| 89 | + appointments_file_id = upload("appointments.csv") |
| 90 | + ``` |
| 91 | + </Tab> |
| 92 | + </Tabs> |
| 93 | + </Step> |
| 94 | +</Steps> |
| 95 | + |
| 96 | +--- |
| 97 | + |
| 98 | +## 2. Create calendar tools |
| 99 | + |
| 100 | +Use the Google Calendar integration for availability and booking, or your own API via a custom tool. |
| 101 | + |
| 102 | +<Tabs> |
| 103 | + <Tab title="Use Google Calendar (recommended)"> |
| 104 | + See: [Google Calendar Integration](/tools/google-calendar) |
| 105 | + |
| 106 | + Configure tools for: |
| 107 | + - `check_availability(service, date)` |
| 108 | + - `book_appointment(customer, service, time)` |
| 109 | + - `reschedule_appointment(appointmentId, time)` |
| 110 | + - `cancel_appointment(appointmentId)` |
| 111 | + </Tab> |
| 112 | + <Tab title="Custom tools (HTTP)"> |
| 113 | + See: [Custom Tools](/tools/custom-tools) |
| 114 | + |
| 115 | + Define function tools that call your scheduling backend. Attach CSV knowledge bases (customers/services) if using the sample data above. |
| 116 | + </Tab> |
| 117 | +</Tabs> |
| 118 | + |
| 119 | +--- |
| 120 | + |
| 121 | +## 3. Create the assistant |
| 122 | + |
| 123 | +<Tabs> |
| 124 | + <Tab title="Dashboard"> |
| 125 | + <Steps> |
| 126 | + <Step title="Create assistant"> |
| 127 | + - Go to Assistants → Create Assistant → Blank template |
| 128 | + - Name it `Receptionist` |
| 129 | + </Step> |
| 130 | + <Step title="Configure system prompt"> |
| 131 | + ```txt title="System Prompt" maxLines=12 |
| 132 | + You are an AI receptionist for a barbershop. Your goals: |
| 133 | + 1) Verify the customer |
| 134 | + 2) Offer booking, rescheduling, or cancellation |
| 135 | + 3) Confirm details and send a confirmation |
| 136 | + |
| 137 | + When needed, call tools: check_availability, book_appointment, reschedule_appointment, cancel_appointment. |
| 138 | + Keep replies under 30 words. Confirm date/time clearly. |
| 139 | + ``` |
| 140 | + </Step> |
| 141 | + <Step title="Attach tools"> |
| 142 | + Add your scheduling tools to the assistant and publish. |
| 143 | + </Step> |
| 144 | + </Steps> |
| 145 | + </Tab> |
| 146 | + <Tab title="TypeScript (Server SDK)"> |
| 147 | + ```typescript |
| 148 | + import { VapiClient } from "@vapi-ai/server-sdk"; |
| 149 | + |
| 150 | + const vapi = new VapiClient({ token: process.env.VAPI_API_KEY! }); |
| 151 | + |
| 152 | + const systemPrompt = `You are an AI receptionist for a barbershop. Verify the customer, then offer booking, rescheduling, or cancellation. Use scheduling tools when needed. Keep replies under 30 words.`; |
| 153 | + |
| 154 | + const assistant = await vapi.assistants.create({ |
| 155 | + name: "Receptionist", |
| 156 | + firstMessage: "Welcome to Tony's Barbershop! How can I help you today?", |
| 157 | + model: { |
| 158 | + provider: "openai", |
| 159 | + model: "gpt-4o", |
| 160 | + messages: [{ role: "system", content: systemPrompt }], |
| 161 | + // toolIds: [ "CHECK_AVAILABILITY_ID", "BOOK_ID", "RESCHEDULE_ID", "CANCEL_ID" ] |
| 162 | + } |
| 163 | + }); |
| 164 | + ``` |
| 165 | + </Tab> |
| 166 | + <Tab title="Python (Server SDK)"> |
| 167 | + ```python |
| 168 | + from vapi import Vapi |
| 169 | + import os |
| 170 | + |
| 171 | + client = Vapi(token=os.getenv("VAPI_API_KEY")) |
| 172 | + |
| 173 | + assistant = client.assistants.create( |
| 174 | + name="Receptionist", |
| 175 | + first_message="Welcome to Tony's Barbershop! How can I help you today?", |
| 176 | + model={ |
| 177 | + "provider": "openai", |
| 178 | + "model": "gpt-4o", |
| 179 | + "messages": [{"role": "system", "content": "You are an AI receptionist for a barbershop. Verify the customer, then handle booking/rescheduling/cancel."}] |
| 180 | + } |
| 181 | + ) |
| 182 | + ``` |
| 183 | + </Tab> |
| 184 | +</Tabs> |
| 185 | + |
| 186 | +--- |
| 187 | + |
| 188 | +## 4. Make calls |
| 189 | + |
| 190 | +<Tabs> |
| 191 | + <Tab title="TypeScript (Server SDK)"> |
| 192 | + ```typescript title="create web call" |
| 193 | + import { VapiClient } from "@vapi-ai/server-sdk"; |
| 194 | + |
| 195 | + const vapi = new VapiClient({ token: process.env.VAPI_API_KEY! }); |
| 196 | + |
| 197 | + await vapi.calls.create({ |
| 198 | + transport: { type: "web" }, |
| 199 | + assistant: { assistantId: "your-assistant-id" } |
| 200 | + }); |
| 201 | + ``` |
| 202 | + |
| 203 | + ```typescript title="create phone call" |
| 204 | + await vapi.calls.create({ |
| 205 | + phoneNumberId: "your-phone-number-id", |
| 206 | + customer: { number: "+15551234567" }, |
| 207 | + assistant: { assistantId: "your-assistant-id" } |
| 208 | + }); |
| 209 | + ``` |
| 210 | + </Tab> |
| 211 | + |
| 212 | + <Tab title="Python (Server SDK)"> |
| 213 | + ```python title="create web call" |
| 214 | + import os |
| 215 | + from vapi import Vapi |
| 216 | + |
| 217 | + client = Vapi(token=os.getenv("VAPI_API_KEY")) |
| 218 | + |
| 219 | + client.calls.create( |
| 220 | + transport={"type": "web"}, |
| 221 | + assistant_id="your-assistant-id", |
| 222 | + ) |
| 223 | + ``` |
| 224 | + |
| 225 | + ```python title="create phone call" |
| 226 | + client.calls.create( |
| 227 | + phone_number_id="your-phone-number-id", |
| 228 | + customer={"number": "+15551234567"}, |
| 229 | + assistant_id="your-assistant-id", |
| 230 | + ) |
| 231 | + ``` |
| 232 | + </Tab> |
| 233 | + |
| 234 | + <Tab title="cURL (web)"> |
| 235 | + ```bash |
| 236 | + curl -X POST "https://api.vapi.ai/call/web" \ |
| 237 | + -H "Authorization: Bearer $VAPI_API_KEY" \ |
| 238 | + -H "Content-Type: application/json" \ |
| 239 | + -d '{ |
| 240 | + "assistant": { "assistantId": "your-assistant-id" } |
| 241 | + }' |
| 242 | + ``` |
| 243 | + </Tab> |
| 244 | + |
| 245 | + <Tab title="cURL (phone)"> |
| 246 | + ```bash |
| 247 | + curl -X POST "https://api.vapi.ai/call" \ |
| 248 | + -H "Authorization: Bearer $VAPI_API_KEY" \ |
| 249 | + -H "Content-Type: application/json" \ |
| 250 | + -d '{ |
| 251 | + "assistant": { "assistantId": "your-assistant-id" }, |
| 252 | + "phoneNumberId": "your-phone-number-id", |
| 253 | + "customer": { "number": "+15551234567" } |
| 254 | + }' |
| 255 | + ``` |
| 256 | + </Tab> |
| 257 | +</Tabs> |
| 258 | + |
| 259 | +## 5. Test and validate |
| 260 | + |
| 261 | +<Steps> |
| 262 | + <Step title="Attach a phone number"> |
| 263 | + Create a phone number and assign your assistant. See [Phone calls quickstart](/quickstart/phone). |
| 264 | + </Step> |
| 265 | + <Step title="Test scenarios"> |
| 266 | + - New booking → check availability → book → confirm |
| 267 | + - Reschedule existing appointment → confirm |
| 268 | + - Cancel appointment → confirm |
| 269 | + </Step> |
| 270 | +</Steps> |
| 271 | + |
| 272 | +## Next steps |
| 273 | + |
| 274 | +- **Tools**: [Google Calendar](/tools/google-calendar), [Custom Tools](/tools/custom-tools) |
| 275 | +- **Structured outputs**: [Extract structured data](/assistants/structured-outputs) |
| 276 | +- **Multichannel**: [Web integration](/quickstart/web) |
| 277 | + |
0 commit comments