cd /news/artificial-intelligence/how-to-build-voice-ai-for-inbound-ca… · home topics artificial-intelligence article
[ARTICLE · art-106687] src=dev.to ↗ pub= topic=artificial-intelligence verified=true sentiment=· neutral

how to build voice ai for inbound calls

A developer detailed a workflow for building a voice AI agent that answers inbound calls, qualifies leads, and books meetings automatically using Vapi, Twilio, Calendly, and n8n. The setup involves creating a Vapi agent via API, configuring Twilio to forward calls, and using n8n to orchestrate webhooks and calendar scheduling. The developer provided step-by-step instructions and configuration snippets for reproducibility.

read8 min views1 publishedAug 22, 2026

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.

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.

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.

https://your-n8n-instance.com/webhook/vapi-inbound

).

Tip:Twilio will send aPOST

request withCallSid

,From

, andTo

on every inbound call. n8n will use those fields to correlate the call with Vapi.

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.

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.

Now tell Twilio to forward the call audio to the Vapi agent you just created.

AGENT_ID

you recorded:

<?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.

n8n will receive the lead data once the Vapi dialogue ends, enrich it, push it to HubSpot (optional), and generate a Calendly link.

POST

and the vapi-complete

. | From | To | |---|---| caller_name | firstname | company | company | challenge | description |

YOUR_CALENDLY_TOKEN

with the personal access token from Calendly's Integrations page.

{
 "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 }}"
 }
 ]
 }
 ]
 }
}

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

).

Deploy the workflow and copy the public webhook URLs; paste them into the Vapi agent's on_complete

and post-call webhook fields respectively.

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.

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'sWebhooknode to respect theRetry-After

header and enableMaximum Retriesset to5

.

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.

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:

vapi-complete

). 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.

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.

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.

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.

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).

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.

── more in #artificial-intelligence 4 stories · sorted by recency
── more on @vapi 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/how-to-build-voice-a…] indexed:0 read:8min 2026-08-22 ·