https://retellai.com/?utm_source=discord&utm_medium=seo logo
how does the inbound webhook work
# ❓・ai-evy-support
k
@AI Evy how does the inbound webhook work?
a
Thanks for tagging me @K Rudy. I'll look through relevant sources and get back to you shortly.
### Answer The inbound webhook notifies your server when an inbound call or SMS is received, allowing you to process it before the call connects. [(1) ]() ## How It Works When an inbound call/SMS comes in, Retell sends a
POST
request to your configured endpoint with the event payload. The webhook has a 10-second timeout and will retry up to 3 times if no 2xx response is received. ### Request Payload Example
Copy code
json
{
  "event": "call_inbound",
  "call_inbound": {
    "agent_id": "agent_12345",
    "agent_version": 1,
    "from_number": "+12137771234",
    "to_number": "+12137771235"
  }
}
Note: The call/SMS is not yet connected at this point, so no call object or call ID exists in the payload. ### Response Options Your response can include (all optional) : -
override_agent_id
– use a different agent -
override_agent_version
– use a specific agent version -
dynamic_variables
– set call-specific variables -
metadata
– attach custom metadata -
agent_override
– override agent settings for this call only ### Common Use Cases - Filter and reject unwanted inbound calls/SMS - Add context (dynamic variables, metadata) to calls - Override agent ID or settings per call - Internal system records of inbound activity ### What Happens If the Webhook Fails? If all retry attempts fail, Retell checks if the number has an inbound agent ID set—if so, it connects to that agent; otherwise, it disconnects the call.
​ To learn more, see the sources I considered: [[1] Inbound webhook](https://docs.retellai.com/features/inbound-call-webhook) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
k
@AI Evy how can i see the dynamic variables this webhook added?
a
Thanks for the follow-up, @K Rudy. I'll get back to you soon.
### Answer You can see the dynamic variables set via the inbound webhook in the call object after the call. The
retell_llm_dynamic_variables
field contains the dynamic variables that were passed at the start of the conversation. [(1) ]() When you retrieve call details using the List Calls API, the response includes:
Copy code
javascript
"retell_llm_dynamic_variables": {
  "customer_name": "John Doe"
}
Additionally, there's a
collected_dynamic_variables
field that shows dynamic variables collected during the call, available after the call ends.
Copy code
javascript
"collected_dynamic_variables": {
  "last_node_name": "Test node"
}
You can also see these variables in the
call_started
webhook event, which includes the dynamic variables passed using the inbound webhook. [(2) ](

▾

)
​ To learn more, see the sources I considered: [[1] List Calls](https://docs.retellai.com/api-references/list-calls) [[2] Personalization with Airtable](

https://www.youtube.com/watch?v=U8jdhkqOOhE▾

) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
k
I did that, but i can’t see the dynamic variables the inbound webhook sent, do i need to do anything in the prompt first?
@AI Evy
a
Thanks for the follow-up, @K Rudy. I'll get back to you soon.
### Answer You don't need to do anything special in the prompt first, but there are a couple of things to check: 1. Response Format – Your webhook response must include the
dynamic_variables
field nested under `call_inbound`: [(1) ]()
Copy code
json
{
  "call_inbound": {
    "dynamic_variables": {
      "first_name": "John",
      "email": "john@example.com"
    }
  }
}
2. All Values Must Be Strings – A common issue is passing non-string values. For example, passing
false
(boolean) instead of
"false"
(string) will cause variables not to be passed to the call. [(2) ]() , [(3) ]() 3. Reference Variables in Your Prompt – To use the variables in your agent, reference them with double curly braces like
{{first_name}}
or
{{email}}
in your prompts, begin message, or tool configurations. , [(4) ]() 4. Check the Webhook URL Location – Make sure your inbound webhook URL is set at the phone number level (via the
inbound_webhook_url
field on the phone number configuration) . [(5) ]() , [(6) ]() If variables still aren't appearing, verify your webhook is actually being called and returning a 2xx status with the correct JSON structure.
​ To learn more, see the sources I considered: [[1] Inbound webhook](https://docs.retellai.com/features/inbound-call-webhook) [[2] Dynamic Variables From Inbound Webhook Not Passed to the Call](https://discord.com/channels/1186424376300679209/1419725903918923920) [[3] Dynamic Variables](https://docs.retellai.com/build/dynamic-variables) [[4] Discord message from @danishkhan18 on 2025-01-27](https://discord.com/channels/1186424376300679209/1186462578310910112/1333229197002543127) [[5] Get Phone Number](https://docs.retellai.com/api-references/get-phone-number) [[6] Inbound Calls Webhook Issue](https://discord.com/channels/1186424376300679209/1420797324535533740) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
Thanks for the follow-up, @K Rudy. I'll get back to you soon.
k
@AI Evy ok I have confirmed that the dynamics variables are populated as intended when looking at the webhook response once the call ends, so the inbound webhook is populating everything as expected. However in the conversation the agent does not seem to read the variables such as {{fist_name}}
a
### Answer If the dynamic variables are correctly populated in the webhook response but the agent isn't reading them during the conversation, here are the most likely issues: 1. Check for Typos in Variable Names You mentioned
{{fist_name}}
— make sure the variable name in your prompt exactly matches what you're sending. If you're sending
first_name
, the prompt must use
{{first_name}}
(not
{{fist_name}}
) . [(1) ]() 2. Handling Missing Variables When a dynamic variable has no assigned value, it remains in its raw form with curly braces intact. For example: - Prompt:
"Hello {{user_name}}, how can I help you today?"
- If
user_name
is not provided:
"Hello {{user_name}}, how can I help you today?"
- If
user_name
is "John":
"Hello John, how can I help you today?"
3. Where Dynamic Variables Work Dynamic variables can be used in: - Prompts (agent instructions and personality) - Begin message (opening greeting) - Tool configurations (custom function URLs, tool descriptions, property descriptions) - Call handling (voicemail prompts, transfer call phone numbers, warm transfer instructions) - Webhook URL 4. Check Variable Existence in Prompts You can add conditional logic in your prompt to handle unset variables:
Copy code
If {{user_name}} appears with curly braces, use a generic greeting.
Otherwise, greet the customer by name.
5. Test in LLM Playground Before deploying, test your dynamic variables using the web interface to confirm they're being substituted correctly. Double-check that the exact variable name (case-sensitive, no typos) matches between your webhook response and your prompt references.
​ To learn more, see the sources I considered: [[1] 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.