https://retellai.com/?utm_source=discord&utm_medium=seo logo
I’m injecting some dynamic variable via api create...
# ❓・ai-evy-support
s
@AI Evy I’m injecting some dynamic variable via api create call, but when asking agent of it, it doesn’t tell
a
Thanks for tagging me @superGamer69. I'll look through relevant sources and get back to you shortly.
### Answer --- When you inject dynamic variables via the
retell_llm_dynamic_variables
field in your API call, the agent doesn't automatically "know" about them unless you reference them in your prompt using the
{{variable_name}}
syntax. [(1) ]() To make your dynamic variables accessible to the agent: 1. Add the variable placeholders in your agent's prompt. For example:
Copy code
"Hello {{customer_name}}, I understand you're interested in {{product_name}}. How can I help you today?"
2. Pass the variables when creating the call: [(2) ]()
Copy code
javascript
const phoneCallResponse = await client.call.createPhoneCall({
  from_number: '+14157774444',
  to_number: '+12137774445',
}) ;
With the
retell_llm_dynamic_variables
field containing:
Copy code
json
{ "customer_name": "John Doe" }
Additional considerations: - If a dynamic variable has no assigned value, it remains in its raw form with curly braces intact (e.g.,
{{user_name}}
will appear literally if not provided) . [(1) ]() - If you're using a Conversation Flow with a Logic Split node at the very start, the variables may not be "hydrated" (fully loaded) yet—consider adding a brief initialization step or using prompt-based logic instead. [(8) ]()
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] Dynamic Variables](https://docs.retellai.com/build/dynamic-variables) [[2] Create Phone Call](https://docs.retellai.com/api-references/create-phone-call) ​
s
@AI Evy so i want to send multiple dynamic variables, like form details users filled, and user can ask about them but not happening how to
a
Thanks for the follow-up, @superGamer69. I'll get back to you soon.
### Answer To send multiple dynamic variables and have the agent reference them, you need to do two things: 1. Pass all variables in
retell_llm_dynamic_variables
as key-value pairs (all values must be strings) :
[(1) ]() , [(2) ]()
Copy code
json
{
  "user_name": "John Smith",
  "email": "john@example.com",
  "phone": "555-1234",
  "product_interest": "Premium Plan",
  "form_submission_date": "December 15, 2025"
}
[(1) ]() 2. Reference each variable in your agent's prompt using
{{variable_name}}
syntax:
Copy code
You are helping a user who submitted a form. Here are their details:
- Name: {{user_name}}
- Email: {{email}}
- Phone: {{phone}}
- Product Interest: {{product_interest}}
- Submission Date: {{form_submission_date}}

Use this information to assist the caller. When they ask about their form details, reference the above variables.
Key points: - All values in
retell_llm_dynamic_variables
must be strings—numbers, booleans, or other data types are not supported. - The agent will only "know" about variables that are explicitly referenced in the prompt. - If a variable isn't provided, it will appear with curly braces intact (e.g.,
{{email}}
) . If variables still aren't being picked up, one community member resolved a similar issue by returning variables via the inbound call webhook format instead: [(3) ]()
Copy code
json
{
  "call_inbound": {
    "dynamic_variables": {
      "user_name": "John Smith",
      "email": "john@example.com"
    }
  }
}
​ To learn more, see the sources I considered: [[1] Dynamic Variables](https://docs.retellai.com/build/dynamic-variables) [[2] Create Phone Call](https://docs.retellai.com/api-references/create-phone-call) [[3] Dynamic Variables](https://discord.com/channels/1186424376300679209/1356680357084135558) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
s
@AI Evy what’s inbound call webhook
a
Thanks for the follow-up, @superGamer69. I'll get back to you soon.
### Answer ### Answer The inbound call webhook is an optional endpoint you configure on your phone number that Retell calls before connecting an inbound call. [(1) ]() What it lets you do: - Filter and reject unwanted inbound calls - Add context (dynamic variables, metadata) to inbound calls - Override agent id / version / specific agent settings for inbound calls - Pause the call to pick it up with some delay - Internal system records of the inbound call How it works: - When someone calls your Retell number, Retell sends a
POST
request to your webhook URL with a payload containing
from_number
,
to_number
, and optionally
agent_id
and
agent_version
. - You respond with JSON to set dynamic variables, override the agent, or reject the call. Sample request payload:
Copy code
json
{
  "event": "call_inbound",
  "call_inbound": {
    "agent_id": "agent_12345",
    "agent_version": 1,
    "from_number": "+12137771234",
    "to_number": "+12137771235"
  }
}
Sample response (to inject dynamic variables) :
Copy code
json
{
  "call_inbound": {
    "dynamic_variables": {
      "user_name": "John Smith",
      "email": "john@example.com"
    }
  }
}
This is useful when you want to pass form details or user-specific data into the call before it connects—exactly what you were trying to do with dynamic variables. [(2) ]() You can set the
inbound_webhook_url
on your phone number via the dashboard or API. [(3) ]()
​ 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) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
s
@AI Evy i use register call to send dynamic variable
a
Thanks for the follow-up, @superGamer69. I'll get back to you soon.
### Answer Yes, you can send dynamic variables when using the Register Phone Call endpoint for custom telephony. [(1) ]() How to pass dynamic variables: Include the
retell_llm_dynamic_variables
field in your request body:
Copy code
javascript
import Retell from 'retell-sdk';
const client = new Retell({
 apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const phoneCallResponse = await client.call.registerPhoneCall({
 agent_id: 'oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD',
}) ;
console.log(phoneCallResponse.agent_id) ;
With
retell_llm_dynamic_variables
structured as:
Copy code
json
{ "customer_name": "John Doe" }
Important reminders: 1. Reference variables in your prompt using
{{variable_name}}
syntax—the agent won't automatically "know" about them otherwise. [(2) ]() 2. All values must be strings. 3. If a variable isn't provided, it remains in raw form (e.g.,
{{customer_name}}
) . If variables still aren't being picked up, one community member resolved a similar issue by returning variables via the webhook response format: [(3) ]()
Copy code
json
{
  "call_inbound": {
    "dynamic_variables": {
        "caller_name": " "
    }
  }
}
Make sure your prompt explicitly references each variable you want the agent to use.
​ To learn more, see the sources I considered: [[1] Register Phone Call](https://docs.retellai.com/api-references/register-phone-call) [[2] Dynamic Variables](https://docs.retellai.com/build/dynamic-variables) [[3] Dynamic Variables](https://discord.com/channels/1186424376300679209/1356680357084135558) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
s
@AI Evy now i also have set extract dynamic variable ( using single prompt agent) I think it is making my dvm empty that i send
a
Thanks for the follow-up, @superGamer69. I'll get back to you soon.
### Answer ### Answer The Extract Dynamic Variables tool is designed to save values from user responses during the conversation, not to overwrite variables you pass in via the API. [(1) ]() However, if you're using the same variable name in both places, the extracted value will replace the one you sent via
retell_llm_dynamic_variables
. [(2) ]() To avoid conflicts: 1. Use different variable names for variables you inject via API vs. variables you extract mid-call. For example: - API-injected:
{{user_name_api}}
- Extracted:
{{user_name_extracted}}
2. Check your Extract Dynamic Variable tool configuration — ensure the variable names defined there don't match the ones you're passing in. [(1) ]() How the Extract Dynamic Variables tool works: - You define variables with a Variable Name, Description, and Variable Type (Text, Number, Enum, or Boolean) . - When the LLM calls this tool, it extracts values from the conversation and saves them under those variable names. - These extracted variables can then be referenced using
{{variable_name}}
syntax. [(2) ]() If you need both injected and extracted data, keep the naming distinct so they don't collide.
​ To learn more, see the sources I considered: [[1] Extract Dynamic Variables](https://docs.retellai.com/build/single-multi-prompt/extract-dv) [[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.
s
@AI Evy when to call extract tool, cuz i have setup to call when new information there, so my latency is increasing
a
Thanks for the follow-up, @superGamer69. I'll get back to you soon.
### Answer The Extract Dynamic Variables tool is invoked by the LLM based on your prompt instructions. [(1) ]() To reduce latency from excessive tool calls: 1. **Be specific in your prompt about when to call the tool.** Instead of "call when new information is there," specify the exact moment. For example:
Copy code
When user states his name and phone number, please extract the information by calling the `extract_user_details` function.
2. Batch your extractions. Rather than extracting after every piece of information, instruct the agent to collect multiple data points first, then call the tool once. For example:
Copy code
After the user has provided their name, email, and phone number, call the extract_user_details function to save all three values at once.
3. Limit the tool's scope. Only define variables you actually need to extract—each variable adds processing overhead. The key is controlling when the LLM decides to invoke the tool through explicit prompt instructions rather than letting it call on every utterance.
​ To learn more, see the sources I considered: [[1] Extract Dynamic Variables](https://docs.retellai.com/build/single-multi-prompt/extract-dv) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.