wolfgang074778
08/08/2025, 3:13 AMAI Evy
08/08/2025, 3:13 AMAI Evy
08/08/2025, 3:13 AMjson
{
"call_inbound": {
"dynamic_variables": {
"first_name": "John"
}
}
}
The key points for troubleshooting:
1. **Webhook Response Format**: Dynamic variables from webhooks must be returned in the specific nested structure shown above, not as flat key-value pairs .
2. **Variable Usage**: Once properly set, you can use them in prompts, tool descriptions, and other locations using the {{first_name}} syntax [(2) ]() .
3. **Testing Approach**: Try a simple test with a minimal prompt that only says "Hi {{first_name}}" to verify the variable is being passed correctly [(3) ]() .
4. **Edge Case Behavior**: If a dynamic variable isn't set properly, it will remain unchanged in its raw form (showing {{first_name}} literally) rather than being replaced [(2) ]() .
Dynamic variables can be used in prompts, begin messages, tool call URLs, tool call descriptions, and other agent components . Make sure your webhook is returning the variables in the correct nested format as shown in the example above.AI Evy
08/08/2025, 3:13 AMAI Evy
08/08/2025, 3:13 AMwolfgang074778
08/08/2025, 3:15 AMwolfgang074778
08/08/2025, 3:16 AMwolfgang074778
08/08/2025, 3:16 AMAI Evy
08/08/2025, 3:16 AMAI Evy
08/08/2025, 3:16 AMdisplay_name and first_name dynamic variables:
For webhook responses, you need to use this specific nested structure [(1) ]() :
json
{
"call_inbound": {
"dynamic_variables": {
"display_name": "John Smith",
"first_name": "John"
}
}
}
Once these variables are properly set through your webhook response, you can use them in your agent configuration using the double curly brace syntax [(2) ]() :
- {{display_name}}
- {{first_name}}
These dynamic variables can be used in prompts, begin messages, tool call URLs, tool call descriptions, custom tool call properties descriptions, voicemail settings, transfer call function numbers, and warm transfer settings .
For outbound calls using the API, you would set them in the retell_llm_dynamic_variables field like this :
json
{
"display_name": "John Smith",
"first_name": "John"
}
The key difference is that webhook responses require the nested call_inbound.dynamic_variables structure, while API calls use the flat retell_llm_dynamic_variables structure , [(1) ]() .AI Evy
08/08/2025, 3:16 AMAI Evy
08/08/2025, 3:16 AMwolfgang074778
08/08/2025, 3:18 AMAI Evy
08/08/2025, 3:18 AMAI Evy
08/08/2025, 3:18 AMdisplay_name and `first_name`:
json
{
"call_inbound": {
"dynamic_variables": {
"display_name": "John Smith",
"first_name": "John"
}
}
}
This matches the expected response format where all fields are grouped under call_inbound . The dynamic_variables field allows you to set dynamic variables for the inbound call .
Once set through your webhook response, you can use these variables in your agent configuration using the double curly brace syntax like {{display_name}} and {{first_name}} [(2) ]() . These dynamic variables can be used in prompts, begin messages, tool call URLs, tool call descriptions, and other agent components .
All values in the dynamic variables must be strings , so make sure your webhook returns string values for both variables.AI Evy
08/08/2025, 3:18 AMAI Evy
08/08/2025, 3:18 AMwolfgang074778
08/08/2025, 3:36 AMAI Evy
08/08/2025, 3:36 AMAI Evy
08/08/2025, 3:36 AMjson
{
"display_name": "Valued Customer",
"first_name": "there"
}
Webhook Response Structure
Your webhook should return immediately with either the found name or fall back to defaults [(1) ]() [(2) ]() :
json
{
"call_inbound": {
"dynamic_variables": {
"display_name": "John Smith",
"first_name": "John"
}
}
}
[(1) ]()
Handle Missing Names Gracefully
Since the webhook has a 10-second timeout and will retry up to 3 times if no success status is received [(3) ]() , you should:
1. Perform a quick database lookup (aim for under 2-3 seconds)
2. If no name is found, return the default values immediately
3. Use the dynamic variables in your prompt like "Hello {{first_name}}, how can I help you today?" [(1) ]()
The dynamic variables can be used in prompts, begin messages, tool call descriptions, and other agent components . Default variables serve as fallbacks and will only be used when specific variables aren't included in the call request .
This approach ensures your agent starts the conversation promptly while still personalizing when possible, without blocking the call flow for database lookups.AI Evy
08/08/2025, 3:36 AMAI Evy
08/08/2025, 3:36 AM