Twilio uses WebSocket media streams for real-time audio. When a call connects, Twilio opens a WebSocket to Rapida carrying μ-law encoded audio at 8kHz. Rapida handles all codec conversion and resampling transparently.
How It Works
Prerequisites
Twilio Account
An active Twilio account with at least one phone number
Rapida Account
An active Rapida account with a configured voice assistant
Step 1: Set Up Provider Credentials
First, store your Twilio API credentials in Rapida so the platform can authenticate with Twilio for outbound calls and webhook validation.1
Navigate to External Integrations
Go to Integration > Tools in the Rapida dashboard. You will see a grid of available external integrations.

2
Select Twilio
Find the Twilio card and click “Setup Credential”.
3
Enter Your Twilio Credentials

Click “Configure” to save.
4
Verify Connection
After saving, the Twilio card should display “Connected”. Click on it to see credential details, last updated time, and management options.
Step 2: Configure Phone Deployment
With credentials saved, configure your assistant’s phone deployment to use Twilio.1
Open Your Assistant
Navigate to Assistants and select the assistant you want to deploy via phone.
2
Go to Phone Deployment
Click “Deploy” → “Phone” to open the phone deployment configuration page.
3
Select Twilio as Telephony Provider
In the Telephony section:
- Select Twilio from the telephony provider dropdown
- Choose the Twilio credential you created in Step 1 from the Credential dropdown
- Enter your Phone number — this is the Twilio phone number that will receive inbound calls and serve as the caller ID for outbound calls (e.g.,
+15551234567)
4
Configure Experience Settings
Set up the conversation experience:
5
Configure Audio Providers
Select your Speech-to-Text (STT) and Text-to-Speech (TTS) providers. These determine how audio is transcribed and synthesized during the call.
For Twilio calls, audio arrives in μ-law 8kHz format. Rapida automatically resamples to 16kHz for the STT provider and converts TTS output back to μ-law for Twilio.
6
Save Deployment
Click “Deploy” to save. Your assistant is now ready to handle phone calls via Twilio.
Step 3: Configure Your Twilio Phone Number
Point your Twilio phone number’s webhook to Rapida so incoming calls are routed to your AI assistant.1
Open Twilio Console
Go to Twilio Console → Phone Numbers → Active Numbers and select your phone number.
2
Set Voice Webhook
Under Voice Configuration, set:
Replace
{your-assistant-id} with your Rapida assistant ID.3
Set Status Callback (Optional)
To receive call lifecycle events (ringing, answered, completed):
The status callback URL uses a
contextId returned during the call setup. Twilio sends events to this URL automatically when configured in TwiML.4
Save
Click Save in the Twilio console. Your phone number is now connected to Rapida.
Making Outbound Calls
Once your phone deployment is configured, you can initiate outbound calls using the Rapida API or SDKs.- Python
- Node.js
- cURL
Features
Troubleshooting
Calls go to voicemail instead of Rapida
Calls go to voicemail instead of Rapida
- Verify the webhook URL in your Twilio phone number configuration
- Ensure the URL uses
https://and the correct assistant ID - Check that your Rapida API key is valid
One-way audio or no audio
One-way audio or no audio
- Verify your Twilio credential (Account SID + Auth Token) is correct in Rapida
- Check that your STT and TTS providers are configured in the phone deployment
- Ensure the assistant has an active version with a valid LLM provider
Outbound calls fail
Outbound calls fail
- Verify the Twilio credential is connected in Integration > Tools
- Ensure the
from_numberis a valid Twilio phone number in your account - Check that the phone deployment is configured and saved
Status callbacks not received
Status callbacks not received
- Ensure the status callback URL is configured in Twilio console
- Verify the URL format:
https://websocket-01.in.rapida.ai/v1/talk/twilio/ctx/{contextId}/event?x-api-key={your-api-key} - Check Twilio’s Debugger for webhook errors
Related Resources
Create an Assistant
Build your voice AI assistant
Phone Deployment
Overview of phone deployment options
Outbound Call API
API reference for creating calls
Conversation Logs
View call history and transcripts