https://retellai.com/?utm_source=discord&utm_medium=seo logo
, how to set fixed variables and pass them to webh...
# ❓・ai-evy-support
i
@AI Evy , how to set fixed variables and pass them to webhooks?
a
Thanks for tagging me @incredible_swan_16923. I'll look through relevant sources and get back to you shortly.
​ To learn more, see the sources I considered: [[1] Webhook Overview](https://docs.retellai.com/features/webhook-overview) [[2] Outbound webhook url](https://discord.com/channels/1186424376300679209/1285612548628025394) ​
### Answer For setting fixed variables that can be passed to webhooks in Retell AI, you can use dynamic variables that get included in the webhook payload. Based on the webhook documentation, when webhook events are triggered, they include
retell_llm_dynamic_variables
in the payload [(1) ]() . Here's how the webhook payload structure looks:
Copy code
json
{
 "event": "call_ended",
 "call": {
 "call_type": "phone_call",
 "from_number": "+12137771234",
 "to_number": "+12137771235",
 "direction": "inbound",
 "call_id": "Jabr9TXYYJHfvl6Syypi88rdAHYHmcq6",
 "agent_id": "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD",
 "call_status": "registered",
 "metadata": {},
 "retell_llm_dynamic_variables": {
 "customer_name": "John Doe"
 },
 "start_timestamp": 1714608475945,
 "end_timestamp": 1714608491736,
 "disconnection_reason": "user_hangup",
 "transcript": "...",
 "transcript_object": [ [Object], [Object], [Object], [Object] ],
 "transcript_with_tool_calls": [ [Object], [Object], [Object], [Object] ],
 "opt_out_sensitive_data_storage": false
 }
}
For outbound calls specifically, you can pass dynamic variables using the
retell_llm_dynamic_variables
parameter in the create phone call API [(2) ]() . This allows you to set fixed variables that will then be included in the webhook payload when webhook events are triggered [(1) ]() . The webhook payload will include these dynamic variables, and if metadata and retell_llm_dynamic_variables are not provided, they will be omitted from the webhook event payload .
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
i
@AI Evy , I need fixed variables to be passed to my webhook for incoming calls
a
Thanks for the follow-up, @incredible_swan_16923. I'll get back to you soon.
### Answer For incoming calls, you can set fixed variables that get passed to your webhook through the inbound call webhook feature [(1) ]() . When an inbound call is received, Retell AI will POST to your webhook endpoint with a payload . You can then respond with dynamic variables that will be set for that call :
Copy code
json
{
 "call_inbound": {
 "override_agent_id": "agent_12345",
 "override_agent_version": 1,
 "dynamic_variables": {
 "customer_name": "John Doe"
 },
 "metadata": {
 "random_id": "12345"
 }
 }
}
The dynamic variables you set in the webhook response will be available throughout the call and can be referenced in your agent's prompt using the
{{variable_name}}
syntax [(2) ]() . For example, if you set
"customer_name": "John Doe"
, you can reference it in your prompt as
{{customer_name}}
. You can also set default values for dynamic variables at the agent level, which will serve as fallbacks when specific variables aren't provided in the webhook response . All values in
dynamic_variables
must be strings - numbers, booleans, or other data types are not supported .
​ To learn more, see the sources I considered: [[1] Inbound call webhook](https://docs.retellai.com/features/inbound-call-webhook) [[2] Dynamic Variables](https://docs.retellai.com/build/dynamic-variables) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.