← All posts
How-ToNovember 23, 2026 · 8 min

How to build voice AI booking assistant with Twilio and ElevenLabs

To build a hands-free voice AI booking assistant you combine Twilio's programmable voice gateway, a speech-to-text engine (such as Deepgram or Whisper), ElevenLabs for natural text-to-speech, and a lightweight backend that manages state and triggers reminders. First, provision a Twilio phone number and configure a Webhook that forwards incoming audio to your STT service via a REST API. The transcribed text is sent to a prompt-engineering module that extracts intent, date, time, and client details, then stores them in a state-management store (e.g., Redis). The response text is passed to ElevenLabs, which returns an audio stream that Twilio streams back to the caller in real time using its <Say> or <Play> verbs. Once the appointment is confirmed, schedule a reminder through Twilio's Realtime API or a WebRTC-enabled outbound call, reducing no-shows in medical and wellness settings.

What you need

The following stack handles the full loop from inbound call to confirmed booking and reminder.

ToolPlan/PriceRole
TwilioCheck current pricingTelephony provider; receives inbound calls and sends outbound SMS/voice reminders via Programmable Voice and Messaging.
VapiCheck current pricingVoice-agent orchestration layer that manages the conversation flow, tool calling, and coordination between STT, LLM, and TTS.
ElevenLabsFrom $5/month (Starter)Text-to-speech engine; generates natural-sounding voice responses for the AI agent.
DeepgramCheck current pricingSpeech-to-text engine; transcribes the patient's speech in real-time for the LLM.
OpenAI GPT-4oCheck current pricingLarge language model; processes transcripts, extracts appointment details, and generates conversational responses.
LatenodeCheck current pricingAutomation workflow engine; triggers database updates, sends confirmation emails, and schedules reminder sequences after the call ends.
PostgreSQLSelf-hosted or managed (e.g., Supabase)Database; stores patient records, appointment slots, and conversation logs for state management.

How it works

1. Call initiation and telephony A patient dials the number hosted on Twilio. Twilio receives the inbound call, establishes a SIP session, and forwards the audio stream to the realtime API of Vapi for orchestration. From the start, Twilio handles 99.99 % availability, so the voice assistant can be built around a reliable telephony backbone.

2. Speech-to-text transcription The audio captured by Twilio is sent to Deepgram's realtime transcription endpoint. Deepgram streams the transcription to Vapi with low latency (≈300 ms). The text is then passed to the prompt-engineering layer that formats it for the booking logic.

3. Dialog and state management Vapi uses its state-management engine to maintain context across turns. The conversation flows through a set of scripted intents (e.g., "schedule appointment", "cancel", "reschedule") that are defined in a lightweight JSON schema. Each intent triggers a REST API call to an external calendar service (Google Calendar or Microsoft Outlook) to verify availability.

4. Appointment creation and confirmation Once a slot is confirmed, Vapi invokes a custom REST API that writes the appointment to a database and generates a unique confirmation ID. ElevenLabs then synthesizes a natural-sounding confirmation message using a pre-trained voice (e.g., "Your appointment is scheduled for 3 pm on May 5. Your reference number is 9876.") and sends it back through Twilio to the caller.

5. Reminder scheduling and no-show prevention The appointment record is fed into a Node-based scheduler (latenode) that queues reminder calls. 24 hours before the appointment, Twilio initiates a call; ElevenLabs reads the reminder script, and Vapi handles the final confirmation prompt. If the patient cancels or reschedules, the same flow updates the calendar and reschedules the next reminder.

6. Analytics and iteration All interaction logs are streamed to a data lake via Twilio's webhooks. This data feeds into a simple analytics pipeline that measures call duration, no-show rates, and voice-recognition accuracy. The insights are then used to refine prompt-engineering rules and voice parameters, closing the loop for continuous improvement.

How to build it

Below is a practical, end-to-end recipe for a low-latency voice AI booking assistant that can answer calls, hold a natural conversation, capture appointment details, store them, and fire a reminder via a voice call. The stack uses Twilio for inbound/outbound telephony, ElevenLabs for high-quality text-to-speech, WebRTC for real-time audio streaming, Latenode for state management, and a thin REST API to persist data. All components run in a Node.js environment, but the pattern works with any language that can host a WebSocket server.

1. Provision the telephony endpoint 1. Sign up at https://www.twilio.com and buy a phone number capable of voice. 2. In the Twilio Console → Phone Numbers → Manage → Active Numbers, set the Voice & Fax → A CALL COMES IN webhook to https://your-domain.com/twilio/voice. Method: POST Content-Type: application/x-www-form-urlencoded

json
{
 "Url": "https://your-domain.com/twilio/voice",
 "Method": "POST"
}

2. Set up a WebRTC bridge with Latenode 1. Deploy a Latenode instance (free tier on Vercel works). 2. Create a node called `voice-bridge` that accepts a Twilio MediaStream and forwards the raw audio to a Whisper-compatible STT endpoint (e.g., Deepgram). 3. In the Twilio webhook response, return TwiML that opens a media stream:

xml
<Response>
 <Connect>
 <Stream url="wss://your-latenode-domain.com/voice-bridge"/>
 </Connect>
</Response>

Latenode will keep the connection alive, buffer the audio, and emit a transcript event as soon as the STT returns text.

3. Add speech-to-text (STT) 1. Register at https://deepgram.com (free tier: 0 min). 2. In the Latenode voice-bridge node, forward the binary audio frames to Deepgram's streaming endpoint:

js
const deepgram = new Deepgram('YOUR_DEEPGRAM_API_KEY');
const dgStream = deepgram.transcription.live({
 punctuate: true,
 model: 'nova',
});
ws.on('audio', chunk => dgStream.send(chunk));
dgStream.on('transcript', data => {
 // Emit to downstream node
 node.emit('transcript', data.channel.alternatives[0].transcript);
});

The transcript arrives in near-real time (<200 ms latency on average).

4. Prompt engineering and state management Create a system prompt that guides the LLM (any OpenAI-compatible model) to ask for name, date, time, and reason. Store each answer in Latenode's state store so the conversation can be resumed after a user pause.

json
{
 "role": "system",
 "content": "You are a friendly medical scheduler. Ask for the patient's full name, the desired appointment date (MM/DD/YYYY), the preferred time slot (HH:MM AM/PM), and the reason for the visit. Validate each answer before moving to the next question. Keep the conversation short and confirm the summary before ending."
}

In the Latenode workflow, after each transcript event, invoke the LLM with the current state:

js
const prompt = [
 systemPrompt,
 ...Object.entries(state).map(([k, v]) => ({ role: 'assistant', content: `${k}: ${v}` }))
];
const response = await openai.chat.completions.create({
 model: 'gpt-4o-mini',
 messages: prompt,
});
state.nextQuestion = response.choices[0].message.content.trim();

5. Persist the appointment via a REST API Deploy a tiny Express service (or use any backend you already have) exposing POST /appointments. The payload matches your internal schema:

json
{
 "patientName": "string",
 "date": "YYYY-MM-DD",
 "time": "HH:mm",
 "reason": "string",
 "phone": "E.164"
}

From the Latenode node that holds the final confirmed summary, call the endpoint:

js
await fetch('https://api.yourdomain.com/appointments', {
 method: 'POST',
 headers: { 'Content-Type': 'application/json' },
 body: JSON.stringify(state)
});

The API should return a unique appointmentId which you store back in the state for later reminder calls.

6. Generate a confirmation voice message with ElevenLabs ElevenLabs provides realistic TTS from $0.05 per minute. Register at https://elevenlabs.io and obtain an API key.

js
const eleven = require('elevenlabs');
const audio = await eleven.textToSpeech({
 apiKey: process.env.ELEVENLABS_KEY,
 voice: 'Bella', // any premium voice
 text: `Your appointment is confirmed for ${state.date} at ${state.time}. We look forward to seeing you, ${state.patientName}.`,
 model_id: 'eleven_monolingual_v1'
});

The returned audio buffer is streamed back to Twilio via the Play verb inside the TwiML response that ends the call:

xml
<Response>
 <Play>https://your-domain.com/static/confirmation-${appointmentId}.mp3</Play>
 <Hangup/>
</Response>

Store the MP3 on a CDN (e.g., Cloudflare R2) for quick retrieval.

7. Schedule a reminder using Twilio's Notify service Twilio Notify can trigger a voice call 24 hours before the appointment.

``js await fetch('https://notify.twilio.com/v1/Services/YOUR_SERVICE_SID/Notifications', { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded', 'Authorization': Basic ${Buffer.from(${process.env.TWILIO_SID}:${process.env.TWILIO_AUTH_TOKEN}).toString('base64')} }, body: new URLSearchParams({ 'ToBinding': JSON.stringify({ binding_type: 'sms', address: state.phone }), 'Body': Reminder: you have an appointment tomorrow at ${state.time}. Reply YES to confirm.`, 'ScheduleType': 'fixed', 'SendAt': new Date(Date.now() + 246060*1000).toISOString()

What it costs to run

The table below estimates monthly infrastructure expenses for a voice booking agent using Vapi for orchestration, Deepgram for speech-to-text, and ElevenLabs for text-to-speech.

Monthly UsesEstimated CostKey Assumptions
100 conversations~$5-$10Uses Vapi's starter tier at ~$0.05/min average call duration.
1,000 conversations~$50-$80Includes buffer for low-volume usage fees on TTS/STT vendors.
10,000 conversations~$400-$600Assumes steady usage; actual costs vary based on average talk time.

These figures exclude Twilio telephony charges, which depend on your geography and carrier rates. Additionally, LLM token costs for the underlying large language model are not itemized above, though they are typically minor compared to audio processing fees. Always verify current pricing on vendor homepages, as rates for services like Vapi and ElevenLabs can shift with volume tiers and feature updates. For a deeper dive into optimizing these variables, see this guide.

How does the assistant handle natural conversation flow during the booking process?

The assistant uses prompt engineering with Vapi's voice-agent orchestration to maintain context across turns, storing dialogue state in a lightweight in-memory store (e.g., Redis). This allows it to ask clarifying questions, adjust to user responses, and keep the conversation natural while capturing appointment details.

Which speech-to-text engine do you recommend for low-latency transcription?

For minimal latency, use Deepgram's real-time API, which delivers text within 300 ms of audio input. Deepgram offers a free tier and starts at $0.01/min for live transcription; you can scale to higher accuracy models as needed.

How are reminders triggered and delivered to patients?

The booking flow stores appointment data in a REST API database and schedules a Twilio Voice call (using the Programmable Voice REST endpoint) at the reminder time. The call uses ElevenLabs TTS to read a concise message, then hands off to a simple IVR for patient confirmation or rescheduling.

What are the pricing implications for a small clinic using this system?

Twilio charges $0.015/min for outbound calls (starting price) and $0.0075/min for inbound. ElevenLabs TTS costs $0.02/min for standard voices; Deepgram offers a free tier with $0.01/min for real-time. Total overhead stays well below $0.05/min for a basic deployment.

Get the full toolkit

Grab the free guide with the node-by-node build for all 10 automations.

By subscribing, you agree to receive this guide plus occasional AI Automation Blueprint educational and product emails. Unsubscribe anytime. Privacy policy.