Twilio
Connect a Twilio number to your agent by pasting your Account SID and auth token into Vapi for CX. The number stays in your Twilio account.
On a Studio or Flex flow? Connecting a number with this form takes it off its flow. To keep the flow, read Studio and Flex before you pick the number.
- Receive calls: Yes.
- Transfer to a phone number: Yes, with an optional spoken summary.
- Transfer to a SIP address: Offered, without a written summary or caller details: details can’t travel from a Twilio number.
- Return the call to their system: Only when a contact center or phone system that takes calls back is linked to the line. See Handing callers to people.
- Place calls: Yes. The caller ID must be a Twilio number on your account or a caller ID verified in Twilio.
Send calls to the agent
Copy your Account SID and auth token
In the Twilio Console, open the dashboard and find Account Info. Copy the Account SID (it starts with AC) and the Auth Token. Use the ones for your account’s main region (US1). For more information, see Twilio’s Account resource.
Only upgraded Twilio accounts can be connected. Vapi for CX refuses a trial account, because a trial account takes calls only from verified numbers.
Paste them into Vapi for CX
On the agent’s setup checklist, open Connect your phone line and choose Use my Twilio numbers. Paste the Account SID and auth token, then choose Find my numbers.
Vapi for CX uses the Account SID and auth token for that request only and stores neither. Vapi stores the auth token with each number it imports, so the number can answer calls and place handoffs.
Pick your numbers
Vapi for CX lists each number on the account and what answers it today. Select the numbers this agent answers and choose Connect. The button shows how many numbers you selected.
- A number already in Vapi is marked. A number in another Vapi organization can’t be connected.
- If a TwiML app (a saved Twilio call-handling setup) or an Elastic SIP trunk answers a number today, selecting the number shows a warning. Twilio ignores a number’s voice address while either is set, so Vapi for CX clears it and saves the old setup for Disconnect to put back.
Vapi imports each number and attaches it to the agent. Vapi sets the number’s voice address and status callback. Nothing else on the number changes. Texts stay on Twilio’s old routing.
Number the agent sees: the caller’s own number. Twilio gives Vapi the caller’s number and the dialed number.
Check it: when Vapi for CX shows Call this number from your phone, call the number from your own phone. The check passes when your call reaches the agent.
Disconnect. Disconnecting a Twilio number never deletes it from your Twilio account. For a number connected with this form, Vapi for CX asks you to paste the Account SID and auth token again, then puts back what answered the number before (its old voice address, TwiML app, or trunk). Vapi for CX detaches the agent and removes the number from Vapi only after Twilio accepts that change, so you can connect it again later with this form. If Twilio refuses the change, the agent stays attached, so calls to the number still reach the agent, and the message says what to set in the Twilio Console.
Someone may have changed the number in the Twilio Console so that its calls no longer go to Vapi, and not back to where they went before. In that case, Disconnect changes nothing at Twilio and only takes the agent off the number. The number stays in your Twilio account and in Vapi with no agent on it, and its calls still go wherever Twilio sends them. To connect it again, choose Use a number already in Vapi.
A Twilio number that was already in Vapi when you picked it with Use a number already in Vapi is only detached, and stays in Vapi.
Hand callers to your team
From a Twilio number, only the call travels: no written summary and no caller details. For how handoffs work, see Handing callers to people.
Transfer to a phone number
Each transfer is a new call out of your Twilio account.
Allow the destination's country
Make sure the destination number’s country is turned on in the Twilio Console, under Voice › Settings › Geo permissions. For more information, see Twilio’s geographic permissions page and Twilio connection errors.
Add the handoff
On the agent’s Call handling tab, choose Add a handoff on the Handing callers to people card and pick Transfer to a phone number. Say when the agent should hand off, and enter the number: a queue, a team, a person’s line, or a Flex number with its own flow. The agent’s own number is refused.
For a handoff to a person’s own line, turn on Say a short summary to whoever answers to play a short summary before the caller is connected. This option exists only on Twilio numbers.
Number whoever answers sees: the caller’s own number, unless you choose otherwise under Their people see. If the caller withheld their number, whoever answers sees the agent’s number.
Transfer to a SIP address
Vapi dials the SIP address as a new call. Only the call travels, with no written summary and no caller details. For a summary, use a handoff to a person’s own line with Say a short summary to whoever answers.
Limitations
- Trial accounts and numbers set up in Twilio’s Ireland (IE1) or Australia (AU1) regions can’t be connected with Vapi for CX’s Twilio form.
- A number that keeps its Studio or Flex flow can’t be connected with Vapi for CX’s Twilio form (see Studio and Flex).
- A Twilio number alone doesn’t allow Return the call to their system. See Handing callers to people.
- Connecting takes your auth token: there is no one-click Twilio sign-in.
- If you rotate the auth token in Twilio, calls out and handoffs stop, and the line shows Twilio sign-in changed: reconnect. Give Vapi the new token on the number in Vapi’s dashboard, through Open Vapi’s phone numbers in the notice under the Twilio line.
- Calls out need the destination’s country turned on under Voice › Settings › Geo permissions, and calls to
+1numbers can be blocked until the account has a Primary Customer Profile in Twilio’s Trust Hub. - Twilio bills its usual per-minute price for each call, and a handoff to a phone number is a second Twilio call for as long as it lasts. Vapi bills its own minutes.
- Texts to US numbers from a Twilio local number need US business texting (10DLC) registration in Twilio.
- For HIPAA, Twilio needs its own business associate agreement (BAA) with you.
Other options
Studio and Flex
Importing a number with the form above takes it off its Studio flow and sends every call to the agent instead. Vapi for CX’s form doesn’t connect a number that keeps its Studio flow, or a Flex number.
Vapi for CX has no steps of its own for sending a flow’s calls to the agent. Twilio’s Connect Call To widget, below, is Twilio’s way.
To keep the flow:
- Leave the number unselected when you pick your numbers in Vapi for CX. Its flow keeps answering, and nothing on the number changes.
- Give the agent a number of its own: keep the starter number, or connect another Twilio number that no flow answers.
- Ring the agent from the flow. Twilio’s documentation describes a Studio Connect Call To widget that rings a phone number. Pointed at the agent’s own number, it is an ordinary call that you set up in Twilio, billed as a second Twilio call for as long as it lasts. Vapi for CX doesn’t set it up or check it.
Other ways to connect Twilio
Elastic SIP Trunking, set up in Vapi’s dashboard. For a number that already sits on a Twilio Elastic SIP trunk shared with a phone system. It takes more work than importing and brings no benefit for a plain Twilio number, so this page gives no steps for it.
It needs a new Elastic SIP trunk in Twilio for the agent (never the trunk the phone system uses), and a SIP trunk in Vapi’s dashboard as Vapi’s Twilio SIP trunk guide describes, with Enable leading plus for outbound calls turned on. You then pick the number in Vapi for CX with Use a number already in Vapi.
Over the trunk, the caller ID must be a Twilio number on the account or a verified caller ID. The trunk places 1 call a second by default, up to 5, set in the Twilio Console.
Before you move a number onto the agent’s trunk, check in the Twilio Console which trunk it is on. If it is on the phone system’s trunk, moving it can stop the phone system receiving that number’s calls. For more information, see Twilio’s Elastic SIP Trunking.
Your own server in front of Vapi. For developers who need conferences or hold. Not self-serve.