For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Connect
BlogHelp CenterAPI PricingSign up
OverviewElevenCreativeElevenAgentsElevenAPIReception AIAPI referenceChangelog
OverviewElevenCreativeElevenAgentsElevenAPIReception AIAPI referenceChangelog
  • Get started
    • Overview
    • Quickstart
  • Configure
    • Overview
    • Voice & language
    • Knowledge base
    • Tools
    • Personalization
      • Dynamic variables
      • Overrides
      • Twilio personalization
    • Authentication
  • Deploy
    • Overview
    • Environment variables
    • WhatsApp
    • Batch calls
  • Monitor
    • Overview
    • Users
    • Testing
    • Experiments
    • Versioning
    • Conversation Analysis
    • Analytics
    • Real-time monitoring
    • OpenTelemetry traces
    • Privacy
    • Cost optimization
    • CLI
  • Advanced
    • Events
    • Custom models
    • LLM cascading
    • Post-call webhooks
  • Resources
    • UI components
  • Guides
    • Chat Mode
    • Burst pricing
    • ElevenLabs' docs agent
    • Scaling user interviews
    • Simulate Conversations
LogoLogo
Login
Login
Connect
BlogHelp CenterAPI PricingSign up
On this page
  • Overview
  • How it works
  • Configuration
  • Security
ConfigurePersonalization

Twilio personalization

Configure personalization for incoming Twilio calls using webhooks.
Was this page helpful?
Previous

Agent authentication

Learn how to secure access to your conversational agents
Next
Built with

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

  1. When a Twilio call is received, ElevenAgents will make a webhook call to your specified endpoint, passing call information (caller_id, agent_id, called_number, call_sid) as arguments
  2. Your webhook returns conversation initiation client data, including dynamic variables and overrides (an example is shown below)
  3. 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, ElevenAgents fetches necessary webhook data
  • The conversation is initiated with the fetched data by the time the audio connection is established

Configuration

1

Configure webhook details

In the settings page of ElevenAgents, configure the webhook URL and add any secrets needed for authentication.

Enable webhook

Click on the webhook to modify which secrets are sent in the headers.

Add secrets to headers

2

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.

Enable webhook

3

Implement the webhook endpoint to receive Twilio data

The webhook will receive a POST request with the following parameters:

ParameterTypeDescription
caller_idstringThe phone number of the caller
agent_idstringThe ID of the agent receiving the call
called_numberstringThe Twilio number that was called
call_sidstringUnique identifier for the Twilio call
4

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 dynamic variables and overrides see the dynamic variables and overrides docs.

An example response could be:

1{
2 "type": "conversation_initiation_client_data",
3 "conversation_config_override": {
4 "agent": {
5 "prompt": {
6 "prompt": "The customer's bank account balance is $100. They are based in San Francisco.",
7 "llm": "gpt-4o"
8 },
9 "first_message": "Hi, how can I help you today?",
10 "language": "en"
11 },
12 "tts": {
13 "voice_id": "new-voice-id"
14 },
15 "conversation": {
16 "text_only": false
17 }
18 },
19 "dynamic_variables": {
20 "customer_name": "John Doe",
21 "account_status": "premium",
22 "last_interaction": "2024-01-15"
23 },
24 "branch_id": "agtbrch_xxxx",
25 "environment": "production"
26}

ElevenAgents 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