https://retellai.com/?utm_source=discord&utm_medium=seo logo
I'm using a webhook where I have response variable...
# ❓・ai-evy-support
t
@AI Evy I'm using a webhook where I have response variables, but I can't seem to grab them, how does it work?
a
Thanks for tagging me @tech_83462. I'll look through relevant sources and get back to you shortly.
​ To learn more, see the sources I considered: [[1] Dynamic Variables](https://docs.retellai.com/build/dynamic-variables) [[2] Webhook Overview](https://docs.retellai.com/features/webhook-overview) [[3] Inbound webhook](https://docs.retellai.com/features/inbound-call-webhook) [[4] Discord message from @sajjadalgburi on 2025-05-27](https://discord.com/channels/1186424376300679209/1186462578310910112/1377059550443606048) [[5] agent not receiving dynamic variables from inbound webhook response](https://discord.com/channels/1186424376300679209/1394015802402930778) ​
### Answer Based on the context, it sounds like you're trying to use dynamic variables with webhooks. Dynamic variables and webhooks serve different purposes in Retell AI [(1) ]() [(2) ]() [(3) ]() . Dynamic variables are used to inject personalized data into your agent's responses and can be used in prompts, begin messages, tool configurations, and call handling [(1) ]() . For inbound calls, you set dynamic variables through the inbound webhook response [(3) ]() . When you receive an inbound call webhook, you respond with a JSON object that can include
retell_llm_dynamic_variables
. Here's the format:
Copy code
json
{
  "call_inbound": {
    "override_agent_id": "your_agent_id",
    "retell_llm_dynamic_variables": {
      "customer_name": "John Doe"
    }
  }
}
For outbound calls, you set dynamic variables when creating the call using the
retell_llm_dynamic_variables
field in the Create Phone Call API [(1) ]() :
Copy code
json
{
  "user_name": "John Smith",
  "product_name": "Premium Plan",
  "account_status": "active"
}
**Important note**: Dynamic variables are specifically for passing data to your agent's prompts and responses - they are not for custom function tools [(4) ]() . If you're trying to access variables returned from custom functions, that works differently than dynamic variables. If you're still having issues, check that your webhook response format matches the expected structure exactly [(5) ]() . The error "Invalid webhook response format" indicates the JSON structure isn't correct .
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
t
@AI Evy I have a function which sends information to a webhook (client name, Date of Birth, Client ID, and any questions the user had) it sends it through a webhook to another site, then it responds with some information relating to the questions.
a
Thanks for the follow-up, @tech_83462. I'll get back to you soon.
### Answer --- Based on your description, it sounds like you're using a custom function/tool that calls an external webhook and expects a response back with data the agent should use [(1) ]() . **Important distinction**: Dynamic variables are set at the start of a call (via inbound webhook response or when creating an outbound call) and are not meant for data returned from custom function tools during the conversation . As noted in the community: "dynamic variables are not for tools but for inbound webhook" . For custom function responses, the agent receives the data you return from your function, but you need to structure your function's response properly so the agent can use it. The agent will have access to whatever you return in the function response, and you should reference that data in your prompts or subsequent conversation flow. If you're trying to make the returned data available as variables throughout the rest of the call (similar to dynamic variables) , that's not how custom functions work in Retell AI. The function response is available to the LLM in context, but it doesn't automatically populate dynamic variable placeholders like
{{variable_name}}
[(2) ]() . What you can do: 1. Return the data from your function in a clear, structured format 2. In your agent's prompt, instruct it how to use the information returned from that specific function 3. The agent can reference and use that returned data in its responses naturally through the conversation context If you need the data to persist across the entire call in a variable-like way, you'd need to set those as dynamic variables at call initiation (for inbound calls via the inbound webhook response [(3) ](
s/inbound-call-webhook) , or for outbound calls when creating the call) . Could you clarify what you're trying to do with the response data? Are you trying to have the agent reference it in its responses, or are you trying to use it in a specific way?
​ To learn more, see the sources I considered: [[1] Discord message from @sajjadalgburi on 2025-05-27](https://discord.com/channels/1186424376300679209/1186462578310910112/1377046905032544358) [[2] Dynamic Variables](https://docs.retellai.com/build/dynamic-variables) [[3] 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.