https://retellai.com/?utm_source=discord&utm_medium=seo logo
how can i setup the dynamic variables of a call by...
# ❓・ai-evy-support
k
@AI Evy how can i setup the dynamic variables of a call by using an inbound webhook
a
Thanks for tagging me @K Rudy. I'll look through relevant sources and get back to you shortly.
### Answer To set up dynamic variables for inbound calls using an inbound webhook, configure the webhook at the phone number level and return the variables in your response [(1) ]() . ## Setup Steps 1. Configure the inbound webhook URL on your phone number (not at the agent level) [(1) ]() [(2) ]() 2. Your webhook will receive a POST request with this payload when an inbound call arrives [(1) ]() :
Copy code
json
{
  "event": "call_inbound",
  "call_inbound": {
    "agent_id": "agent_12345",
    "agent_version": 1,
    "from_number": "+12137771234",
    "to_number": "+12137771235"
  }
}
3. Return a JSON response with dynamic variables under the
call_inbound
key :
Copy code
json
{
  "call_inbound": {
    "dynamic_variables": {
      "customer_name": "John Doe"
    },
    "metadata": {
      "random_id": "12345"
    }
  }
}
The webhook has a 10-second timeout and will retry up to 3 times if no success status (2xx) is received . You can also override the agent ID, agent version, and other agent settings in the same response . **Important**: The inbound webhook must be configured at the phone number level, not the agent level [(2) ]() [(3) ]() .
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
​ To learn more, see the sources I considered: [[1] Inbound webhook](https://docs.retellai.com/features/inbound-call-webhook) [[2] Receive calls](https://docs.retellai.com/deploy/inbound-call) [[3] Inbound webhook in create agent](https://discord.com/channels/1186424376300679209/1344300058291605554) ​
k
@AI Evy ok, whats the metadata for, does it need to be added always?
a
Thanks for the follow-up, @K Rudy. I'll get back to you soon.
### Answer Metadata is optional—you don't need to include it in your inbound webhook response [(1) ]() . Purpose of metadata: Metadata is free-form data that gets stored with the call for your own internal tracking or system records . You can use it to store information like customer IDs, campaign tags, or any other contextual data you want associated with the call [(2) ]() . Key differences: - **dynamic_variables**: Used to inject personalized data into your agent's prompts and responses (like
{{customer_name}}
) [(1) ]() [(3) ]() - **metadata**: Stored with the call object for your reference but not directly used in the conversation [(1) ]() [(2) ]() Both fields are optional in your webhook response [(1) ]() . You only need to include the fields that are relevant to your use case.
​ To learn more, see the sources I considered: [[1] Inbound webhook](https://docs.retellai.com/features/inbound-call-webhook) [[2] Outbound Calls (Make Calls)](https://docs.retellai.com/deploy/outbound-call) [[3] 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.