You can have a Vapi agent answer every inbound call, ask qualifying questions, and hand the prospect off to Calendly to lock in a meeting - all without writing a single line of custom telephony code. The result is a self-contained voice AI agent that routes calls, captures lead data, and books calendar slots automatically.
voice is the audible sound produced by a human speaker that can be captured, transmitted, and synthesized by software. voice AI agent is a software component that receives spoken input over a phone line, runs speech-to-text, applies a language model, and returns synthesized speech to the caller.
Below you'll find everything you need to reproduce the exact workflow, from the required services to the n8n JSON that creates the Vapi agent, plus the pitfalls that usually bite new builders.
What you need
| Tool | Plan / Price | Role |
|---|---|---|
| Vapi | Free tier or paid plan - check the Vapi pricing page | Voice AI platform that hosts the conversational model and performs voice synthesis |
| Twilio | Pay-as-you-go voice minutes - check Twilio pricing | Provides the inbound phone number and SIP termination for Vapi |
| Calendly | Free tier or paid plan - check Calendly pricing | Calendar link generator and meeting scheduler |
| n8n (self-hosted) | Community edition - free (Docker) | Orchestrates the webhook chain between Vapi, Twilio, and your CRM |
| HubSpot CRM (optional) | Free tier - check HubSpot pricing | Stores qualified lead details for follow-up |
Estimated build time: 1-2 days for a minimal production-ready flow, assuming you already have accounts for the services above.
how to build voice ai for inbound calls
The core of the solution is a Vapi "agent" that runs a scripted dialogue, a Twilio phone number that forwards calls to Vapi, and an n8n workflow that receives the webhook payload, enriches the lead, and creates a Calendly event. Follow each numbered step precisely; the configuration values are written exactly as they appear in the UI.
1. Provision a Twilio phone number
- Log into the Twilio Console and navigate to Phone Numbers → Manage → Active Numbers.
- Click Buy a Number, select a local US number, and press Buy.
- In the Configure tab for the new number, set Voice & Fax → A CALL COMES IN to Webhook and paste the URL that n8n will expose later (e.g.,
https://your-n8n-instance.com/webhook/vapi-inbound). - Save the changes.
Tip: Twilio will send a
POSTrequest withCallSid,From, andToon every inbound call. n8n will use those fields to correlate the call with Vapi.
2. Create a Vapi agent that qualifies leads
Vapi agents are defined via a JSON payload that describes the prompt, voice synthesis settings, and webhook callbacks. Use the Vapi dashboard or API; the snippet below is the API version for reproducibility.
What this does: Sends a POST request to Vapi's /v1/agents endpoint, creating an agent that asks the caller for name, company, and a brief need description, then forwards the captured slots to a webhook.
Replace YOUR_VAPI_API_KEY with the secret you generate in the Vapi dashboard under API Keys. After a successful call, the response contains an agent_id; copy that value for the next step.
3. Wire Twilio to Vapi
Now tell Twilio to forward the call audio to the Vapi agent you just created.
- In the Twilio Console, open the phone number's Voice configuration again.
- Change A CALL COMES IN from Webhook to Twiml Bin.
- Create a new Twiml Bin with the following XML, inserting the
AGENT_IDyou recorded:
Save the Twiml Bin and associate it with the phone number. Twilio now streams the call directly into the Vapi agent, which will run the qualification script defined earlier.
4. Set up the n8n webhook for Vapi completion
n8n will receive the lead data once the Vapi dialogue ends, enrich it, push it to HubSpot (optional), and generate a Calendly link.
- Create a new workflow in n8n and add a Webhook node.
- Set the HTTP Method to
POSTand the Path tovapi-complete. - Add a Set node to rename fields to match HubSpot's property names:
| From | To |
|---|---|
caller_name | firstname |
company | company |
challenge | description |
- (Optional) Add a HubSpot node configured with your API key to Create Contact using the fields from the Set node.
- Add an HTTP Request node that calls Calendly's "Create Invitee" endpoint. Use the following JSON payload; replace
YOUR_CALENDLY_TOKENwith the personal access token from Calendly's Integrations page.
- Connect the HTTP Request node's output to a Respond to Webhook node that reads the
invitee_urifrom Calendly's response and speaks it back to the caller via Vapi's callback feature. In Vapi's dashboard, set Post-call webhook to point at the n8n Webhook node you just created (e.g.,https://your-n8n-instance.com/webhook/vapi-return).
- Deploy the workflow and copy the public webhook URLs; paste them into the Vapi agent's
on_completeand post-call webhook fields respectively.
5. Test the end-to-end flow
- Dial the Twilio number from any phone.
- Vapi should answer, ask the three qualification questions, and confirm that a calendar link will be sent.
- After the last answer, the n8n webhook triggers, creates a HubSpot contact (if enabled), and returns a Calendly scheduling URL.
- Vapi speaks the URL back (or you can have it send an SMS via Twilio for easier click-through).
If you hear the call drop or the conversation stops after the last question, check the Vapi agent logs and the n8n execution history for HTTP errors.
Where this breaks
Building a voice AI pipeline sounds linear, but several hidden constraints surface in production.
Rate limits - Vapi caps outbound webhook calls at 500 requests per hour on the free tier. If you expect more inbound traffic, upgrade or implement exponential back-off in the n8n HTTP Request node.
Auth token expiry - Both Vapi and Calendly use bearer tokens that rotate every 30 days. If a token expires, the webhook will return 401 Unauthorized and the workflow halts. Set up a Cron node in n8n that refreshes the Calendly token using the OAuth refresh endpoint, and store the fresh token in an Environment Variable.
Twilio call failures - If the Twilio number is not correctly linked to the Sip address (sip:AGENT_ID@sip.vapi.ai), the call will end with "Call failed". Double-check the AGENT_ID value and ensure the Sip domain is reachable (no firewall blocking port 5060).
Voice synthesis latency - Vapi's TTS can take up to 3 seconds per utterance on the free tier. If you chain many prompts, callers may perceive lag. Keep the dialogue under four turns, or pre-generate static prompts and serve them via the Play verb in Twiml.
CRM field mismatch - HubSpot expects specific property IDs; if the Set node's field names do not match, the contact creation fails silently. Verify the property keys in HubSpot's Custom Properties section and adjust the Set node mapping accordingly.
Warning: Ignoring webhook retry headers will cause lost lead data under high load. Configure n8n's Webhook node to respect the
Retry-Afterheader and enable Maximum Retries set to5.
How does call routing work in Vapi?
Vapi uses SIP (Session Initiation Protocol) to accept inbound audio streams. When Twilio forwards a call to sip:AGENT_ID@sip.vapi.ai, Vapi creates a media session that runs the LLM-driven script, captures speech-to-text in real time, and sends synthesized audio back over the same channel. The on_complete webhook is only triggered after the dialogue finishes or the caller hangs up. Understanding this flow helps you debug why a call might appear muted: the SIP handshake may have timed out if the Vapi agent is still initializing. In that case, restart the agent via the Vapi dashboard or re-POST the creation payload.
Which automation workflow connects voice AI, CRM, and scheduling?
The n8n workflow described in step 4 is the glue that turns raw voice data into actionable business objects. It follows a classic trigger → transform → action pattern:
- Trigger: Vapi webhook (
vapi-complete). - Transform: Set node renames slots to CRM field names.
- Action 1: HubSpot node creates or updates a contact.
- Action 2: HTTP Request node calls Calendly's Create Invitee API.
- Return: Respond node gives the caller a spoken link.
Because each node is a discrete, reusable component, you can swap HubSpot for Salesforce, or Calendly for Microsoft Bookings, without rewriting the entire pipeline. This modularity is what makes the automation workflow robust for scaling.
For a deeper technical reference, see n8n's documentation.
FAQ
How much does it cost to run this voice AI agent?
All the tools have free tiers that let you prototype end-to-end. Production usage (high call volume, advanced voice models, or premium Calendly features) may require paid plans. Check the Vapi, Twilio, and Calendly pricing pages for the latest rates.
What if I want to use a different CRM?
n8n supports dozens of CRM integrations out of the box. Replace the HubSpot node with the appropriate node (e.g., Salesforce, Pipedrive) and adjust the field mapping in the Set node to match the target CRM's schema.
Can I host Vapi on my own server to avoid cloud fees?
Vapi is a hosted SaaS product; there is no self-hosted edition. If you need on-premise control, you would have to replace Vapi with an open-source stack such as Mozilla DeepSpeech + Coqui TTS, but that adds significant engineering overhead.
How do I handle international callers?
Twilio supplies phone numbers in many countries. Purchase the appropriate national number, and update the Voice → A CALL COMES IN webhook URL to point at the same n8n endpoint. Vapi's TTS supports dozens of locales; set the voice field in the agent payload to the appropriate language code (e.g., en-GB-Standard-A for UK English).
Where can I learn more about building AI-powered phone agents?
Our free guide walks you through every API call, includes sample n8n workflows, and shows how to monetize the solution: https://getaab.com/free. For ideas on packaged products you can sell, see our curated list of AI automations you can sell: https://getaab.com/ai-automations-to-sell.
By following these steps you now have a fully functional voice AI agent that answers inbound calls, qualifies leads, and books meetings without any manual intervention. The same pattern can be duplicated for support hotlines, appointment reminders, or any scenario where spoken interaction needs to be automated at scale. Happy building.