Twilio Personalization
Configure personalization for incoming Twilio calls using webhooks.
Overview
When receiving inbound Twilio calls, you can dynamically fetch conversation initiation data through a webhook. This allows you to customize your agent’s behavior based on caller information and other contextual data.
How it works
- When a Twilio call is received, the ElevenLabs Conversational AI platform will make a webhook call to your specified endpoint, passing call information (
caller_id
,agent_id
,called_number
,call_sid
) as arguments - Your webhook returns conversation initiation client data, including dynamic variables and overrides (an example is shown below)
- This data is used to initiate the conversation
The system uses Twilio’s connection/dialing period to fetch webhook data in parallel, creating a seamless experience where:
- Users hear the expected telephone connection sound
- In parallel, theConversational AI platform fetches necessary webhook data
- The conversation is initiated with the fetched data by the time the audio connection is established
Configuration
Configure webhook details
In the settings page of the Conversational AI platform, configure the webhook URL and add any secrets needed for authentication.
Click on the webhook to modify which secrets are sent in the headers.
Enable fetching conversation initiation data
In the “Security” tab of the agent’s page, enable fetching conversation initiation data for inbound Twilio calls, and define fields that can be overridden.
Implement the webhook endpoint to receive Twilio data
The webhook will receive a POST request with the following parameters:
Return conversation initiation client data
Your webhook must return a JSON response containing the initiation data for the agent.
The dynamic_variables
field must contain all dynamic variables defined for the agent. Overrides
on the other hand are entirely optional. For more information about dyanmic variables and
overrides see the dynamic variables and
overrides docs.
An example response could be:
The Conversational AI platform will use the dynamic variables to populate the conversation initiation data, and the conversation will start smoothly.
Ensure your webhook responds within a reasonable timeout period to avoid delaying the call handling.
Security
- Use HTTPS endpoints only
- Implement authentication using request headers
- Store sensitive values as secrets through the ElevenLabs secrets manager
- Validate the incoming request parameters