← All posts
How-ToAugust 21, 2026 · 8 min

how to build voice ai for inbound calls

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

ToolPlan / PriceRole
VapiFree tier or paid plan - check the Vapi pricing pageVoice AI platform that hosts the conversational model and performs voice synthesis
TwilioPay-as-you-go voice minutes - check Twilio pricingProvides the inbound phone number and SIP termination for Vapi
CalendlyFree tier or paid plan - check Calendly pricingCalendar 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 pricingStores 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

  1. Log into the Twilio Console and navigate to Phone Numbers → Manage → Active Numbers.
  2. Click Buy a Number, select a local US number, and press Buy.
  3. 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).
  4. Save the changes.

Tip: Twilio will send a POST request with CallSid, From, and To on 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.

bash
curl -X POST https://api.vapi.ai/v1/agents \
 -H "Authorization: Bearer YOUR_VAPI_API_KEY" \
 -H "Content-Type: application/json" \
 -d '{
 "name": "Lead Qualifier",
 "voice": "en-US-Standard-C",
 "prompt": {
 "system": "You are a friendly sales development rep. Greet the caller, ask for name, company, and a short description of their challenge. Then say: I will send you a link to book a time with our specialist.",
 "temperature": 0.7
 },
 "slots": [
 {"name": "caller_name", "type": "string", "question": "May I have your name?"},
 {"name": "company", "type": "string", "question": "Which company are you representing?"},
 {"name": "challenge", "type": "string", "question": "Briefly describe the problem you want to solve."}
 ],
 "on_complete": {
 "webhook_url": "https://your-n8n-instance.com/webhook/vapi-complete",
 "method": "POST"
 }
 }'

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.

  1. In the Twilio Console, open the phone number's Voice configuration again.
  2. Change A CALL COMES IN from Webhook to Twiml Bin.
  3. Create a new Twiml Bin with the following XML, inserting the AGENT_ID you recorded:
xml
<?xml version="1.0" encoding="UTF-8"?>
<Response>
 <Dial>
 <Sip>sip:AGENT_ID@sip.vapi.ai</Sip>
 </Dial>
</Response>

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.

  1. Create a new workflow in n8n and add a Webhook node.
  2. Set the HTTP Method to POST and the Path to vapi-complete.
  3. Add a Set node to rename fields to match HubSpot's property names:
FromTo
caller_namefirstname
companycompany
challengedescription
  1. (Optional) Add a HubSpot node configured with your API key to Create Contact using the fields from the Set node.
  2. Add an HTTP Request node that calls Calendly's "Create Invitee" endpoint. Use the following JSON payload; replace YOUR_CALENDLY_TOKEN with the personal access token from Calendly's Integrations page.
json
{
 "method": "POST",
 "url": "https://api.calendly.com/scheduled_events",
 "headers": {
 "Authorization": "Bearer YOUR_CALENDLY_TOKEN",
 "Content-Type": "application/json"
 },
 "body": {
 "max_event_count": 1,
 "owner": "https://api.calendly.com/users/YOUR_USER_UUID",
 "invitees": [
 {
 "email": "{{ $json.email }}",
 "name": "{{ $json.firstname }}",
 "custom_questions": [
 {
 "question": "Company",
 "answer": "{{ $json.company }}"
 },
 {
 "question": "Challenge",
 "answer": "{{ $json.description }}"
 }
 ]
 }
 ]
 }
}
  1. Connect the HTTP Request node's output to a Respond to Webhook node that reads the invitee_uri from 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).
  1. Deploy the workflow and copy the public webhook URLs; paste them into the Vapi agent's on_complete and post-call webhook fields respectively.

5. Test the end-to-end flow

  1. Dial the Twilio number from any phone.
  2. Vapi should answer, ask the three qualification questions, and confirm that a calendar link will be sent.
  3. After the last answer, the n8n webhook triggers, creates a HubSpot contact (if enabled), and returns a Calendly scheduling URL.
  4. 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-After header and enable Maximum Retries set to 5.


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:

  1. Trigger: Vapi webhook (vapi-complete).
  2. Transform: Set node renames slots to CRM field names.
  3. Action 1: HubSpot node creates or updates a contact.
  4. Action 2: HTTP Request node calls Calendly's Create Invitee API.
  5. 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.

Get the full toolkit

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

No spam. Unsubscribe anytime. Just the good stuff.