← All posts
How-ToOctober 15, 2026 · 9 min

How to build a virtual sales rep with Twilio Voice and GPT-4

To build a virtual sales rep that answers inbound calls, transcribes conversations, and logs data, combine Twilio for telephony, Whisper for speech-to-text transcription, and GPT-4 for conversational intelligence. Twilio receives and routes calls; Whisper converts audio to text in real time; GPT-4 generates contextual responses based on your sales script and prospect data. Use n8n or Zapier to orchestrate the workflow - triggering call events, passing transcripts to GPT-4, and syncing qualified leads to HubSpot. This architecture lets your virtual sales rep handle common objections, qualify prospects, and log interaction details automatically, reducing manual call handling while maintaining conversation quality. The entire stack costs under $0.10 per call in infrastructure.

What you need

A virtual sales rep that answers calls requires a telephony backbone, speech recognition, language generation, and CRM integration. Here's the stack:

ToolPlan/PriceRole
Twiliofrom $0.01/min inbound voice + $0.0075/min outboundReceives inbound calls, routes to your automation, records audio
Whisper (OpenAI)$0.02 per minute of audioTranscribes call audio to text in real time or post-call
GPT-4$0.03/1K input tokens, $0.06/1K output tokensGenerates responses to caller questions, logs call intent and data
n8nFree self-hosted or from $20/month cloudOrchestrates the workflow: Twilio → Whisper → GPT-4 → HubSpot
HubSpotFree CRM tier or from $45/month Sales HubStores caller contact info, call transcript, and deal stage
Zapierfrom $19.99/monthAlternative to n8n for lighter workflows; connects Twilio to HubSpot directly

The call flow: Twilio receives the inbound call and webhooks your automation. n8n captures the audio stream, sends it to Whisper for transcription, passes the text to GPT-4 for a response (or decision logic), and logs the result to HubSpot. For real-time voice responses, integrate Twilio's text-to-speech or swap in ElevenLabs (from $11/month for 10K characters) for higher-quality synthetic voices.

How it works

  1. Inbound call arrives via Twilio Voice. A prospect dials your business number provisioned through Twilio (from $0.01/min for inbound calls). Twilio routes the call to your webhook endpoint and holds the connection open.
  1. Whisper transcribes the caller's speech in real time. As the caller speaks, Twilio streams audio to OpenAI's Whisper API, which converts speech to text with ~95% accuracy. The transcript is returned within 1-2 seconds of the caller finishing their sentence.
  1. GPT-4 generates a contextual response. The transcript is sent to GPT-4 (via the OpenAI API) with a system prompt defining your sales rep's role, tone, and product knowledge. GPT-4 outputs a natural response - e.g., "I'd be happy to walk you through our pricing tiers" - in 200-400 ms.
  1. ElevenLabs converts the response to voice. GPT-4's text output is sent to ElevenLabs (from $5/month for API access) to generate natural-sounding speech in your chosen voice. The audio file streams back to Twilio in under 2 seconds.
  1. Twilio plays audio and loops. Twilio plays the AI-generated voice back to the caller. The call loop repeats: listen → transcribe → generate → speak.
  1. N8n or Zapier logs the call data. After the call ends, Twilio triggers a webhook to n8n or Zapier, which extracts the full transcript, caller metadata, and conversation outcome, then writes the record to HubSpot as a new activity or contact note.

How to build it

  1. Set up Twilio Voice inbound routing. Create a Twilio phone number and configure it to forward incoming calls to a webhook. In your Twilio Console, go to Phone Numbers > Active Numbers, select your number, and set the Voice configuration to "Webhook" with your n8n or Zapier public webhook URL. Twilio will POST call metadata (caller ID, timestamp, call SID) to this endpoint when a call arrives.
  1. Create an n8n workflow to receive and transcribe the call. Start with an HTTP Request node set to POST method. This node receives the Twilio webhook payload. Add a second node (HTTP Request, GET method) that calls the Twilio Recordings API to fetch the call recording URL once the call completes. Use the call SID from step 1 to construct the recording fetch request: https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Recordings/{RecordingSid}. Authenticate with your Twilio Account SID and Auth Token (Basic Auth).
  1. Integrate Whisper for speech-to-text transcription. After retrieving the recording, pass the audio URL to OpenAI's Whisper API via an HTTP Request node. Send a POST request to https://api.openai.com/v1/audio/transcriptions with the audio file and model set to whisper-1. Include your OpenAI API key in the Authorization header. Whisper will return a JSON object containing the text field - this is your call transcript.
  1. Route the transcript through GPT-4 for intent classification and response generation. Create an HTTP Request node that calls OpenAI's Chat Completions endpoint (https://api.openai.com/v1/chat/completions) with the transcript as user input. Use the system prompt below to instruct GPT-4 to classify the caller's intent (e.g., "schedule demo," "pricing inquiry," "support issue"), extract key details (name, email, company), and generate a natural response the virtual sales rep should deliver.
json
{
 "model": "gpt-4",
 "messages": [
 {
 "role": "system",
 "content": "You are a virtual sales representative. Analyze the caller's request and respond with a JSON object containing: (1) 'intent' (string: 'demo_request', 'pricing_inquiry', 'support', 'other'), (2) 'caller_name' (string or null), (3) 'caller_email' (string or null), (4) 'caller_company' (string or null), (5) 'key_details' (string: summary of what the caller needs), (6) 'response' (string: a friendly, concise reply to the caller, 1-2 sentences). Do not include markdown or extra formatting."
 },
 {
 "role": "user",
 "content": "{{ $node[\"Whisper Transcription\"].json.text }}"
 }
 ],
 "temperature": 0.7,
 "max_tokens": 500
}
  1. Log the call and extracted data to HubSpot. Create an HTTP Request node (POST method) to HubSpot's Contacts API. Use the caller name and email extracted by GPT-4 to create or update a contact. Send a request to https://api.hubapi.com/crm/v3/objects/contacts with the following payload structure:
json
{
 "properties": {
 "firstname": "{{ $node[\"GPT-4 Analysis\"].json.caller_name }}",
 "email": "{{ $node[\"GPT-4 Analysis\"].json.caller_email }}",
 "company": "{{ $node[\"GPT-4 Analysis\"].json.caller_company }}",
 "hs_lead_status": "{{ $node[\"GPT-4 Analysis\"].json.intent }}",
 "notes": "Call transcript: {{ $node[\"Whisper Transcription\"].json.text }}\n\nAnalysis: {{ $node[\"GPT-4 Analysis\"].json.key_details }}"
 }
}

Include your HubSpot Private App token in the Authorization header.

  1. Create a HubSpot task or deal based on intent. Add a conditional node (IF statement) that checks the intent value from GPT-4. If intent is "demo_request," create a Deal in HubSpot using another HTTP Request node (POST to /crm/v3/objects/deals). If intent is "pricing_inquiry," create a Task assigned to your sales team. This ensures follow-up actions are automated.
  1. Synthesize and deliver a voice response (optional but recommended). Use ElevenLabs or Twilio's text-to-speech to convert GPT-4's response into audio. Call the ElevenLabs API (https://api.elevenlabs.io/v1/text-to-speech/{voice_id}) with the response text, then stream the resulting audio back to the caller via Twilio's <Play> TwiML verb. This creates a two-way conversation loop.
  1. Test end-to-end with a test call. Call your Twilio number, leave a message like "Hi, I'd like to schedule a demo for your product." Monitor your n8n execution logs to verify each step: webhook receipt, recording retrieval, Whisper transcription, GPT-4 analysis, and HubSpot logging. Check HubSpot to confirm the contact and deal were created.
  1. Set up error handling and retry logic. Add Error nodes after each API call to catch failed transcriptions or HubSpot writes. Configure retry nodes with exponential backoff (1s, 2s, 4s) for transient failures. Log failures to a Slack channel or email so your team knows when a call wasn't processed.

What it costs to run

Component100 calls/mo1,000 calls/mo10,000 calls/mo
Twilio Voice inbound$0.50-$2$5-$20$50-$200
Whisper transcription$1-$2$10-$20$100-$200
GPT-4 API (8K tokens avg)$5-$10$50-$100$500-$1,000
HubSpot (Professional)$50$50$50
n8n (self-hosted or cloud)$0-$20$0-$20$0-$100
Total$57-$84$115-$210$700-$1,550

Assumptions: - Twilio inbound rates vary by geography; assumes US domestic ($0.0085/min average) with 5-40 min calls. - Whisper costs $0.02 per minute; assumes 50-80% of call length transcribed. - GPT-4 input at $0.03/1K tokens, output at $0.06/1K; assumes 2,000-3,000 tokens per call (context + response). - HubSpot Professional tier ($50/mo) for contact and call logging; check current pricing for add-ons. - n8n: self-hosted is free; cloud Pro starts at $20/mo; Zapier equivalent ranges $20-$200/mo depending on task volume.

Where this breaks

Whisper transcription lag on poor audio If the caller speaks over background noise or uses a poor connection, Whisper may return garbled or incomplete text, causing GPT-4 to misinterpret intent and give irrelevant responses. Run audio through a noise-suppression filter before sending to Whisper; Twilio's media streams support real-time preprocessing, or use a dedicated noise-reduction service like Deepgram (which offers built-in noise cancellation) instead of raw Whisper.

GPT-4 hallucinating product details The model may confidently invent pricing, features, or availability that don't match your actual CRM data, damaging credibility and creating follow-up work. Inject a retrieval step: before GPT-4 generates a response, query HubSpot or your product database via n8n or Zapier to fetch real product specs and pricing, then pass those facts into the system prompt as a grounding context block.

Call drops during long hold or transfer If the virtual sales rep needs to look up information or transfer to a human, the Twilio session may timeout or drop if no audio plays for >30 seconds. Send periodic hold music or status updates ("I'm checking inventory now") using Twilio's <Say> or <Play> verbs; set a maximum hold time of 2-3 minutes before offering callback or escalation.

HubSpot sync race condition Two simultaneous calls may attempt to create or update the same contact record, causing duplicate entries or lost call notes. Use n8n's built-in deduplication logic (check HubSpot for existing email before insert) and add a 2-second retry delay with exponential backoff if a write fails; alternatively, enable HubSpot's duplicate management rules to auto-merge records on email match.

Can a virtual sales rep handle complex product questions?

A virtual sales rep built on GPT-4 can answer product questions within its training data and any context you inject (product docs, pricing sheets, competitor comparisons). For questions outside its knowledge base, the workflow should route the call to a human agent via Twilio's call transfer or log the question for follow-up, then continue with qualifying the lead.

How do I prevent the virtual sales rep from saying the wrong thing?

Use a system prompt that constrains GPT-4 to a specific script or FAQ, and test extensively with real call recordings before going live. Pair this with Whisper transcription to log every call for compliance and review - if the rep makes a mistake, you have the exact transcript and can retrain the prompt or add guardrails.

What's the cost to run a virtual sales rep on Twilio and GPT-4?

Twilio charges roughly $0.01-$0.03 per minute for inbound calls depending on region; GPT-4 API costs $0.03 per 1K input tokens and $0.06 per 1K output tokens; Whisper transcription is $0.02 per minute. A 5-minute sales call typically costs $0.25-$0.50 in API fees plus Twilio carrier charges - substantially cheaper than a human rep but requires upfront workflow setup in n8n or Zapier.

How do I connect the call transcript and lead data to HubSpot?

After each call, n8n or Zapier can extract the lead name, phone, and call outcome from Whisper's transcript and GPT-4's structured output (JSON), then create or update a contact in HubSpot via its API. Set up a workflow trigger on Twilio webhook events, parse the transcript for intent (demo request, pricing inquiry, objection), and map those fields to HubSpot deal stages automatically.

For a deeper technical reference, see n8n's documentation.

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.