https://retellai.com/?utm_source=discord&utm_medium=seo logo
if I grab a dynamic variable, like something that ...
# 💬・general
r
@AI Evy if I grab a dynamic variable, like something that was spoken, will that show up in the call_analyzed payload?
a
Thanks for tagging me @realee_23147. I'll look through relevant sources and get back to you shortly.
### Answer Yes, dynamic variables that are collected during the call will show up in the call analysis payload [(1) ]() . The API response includes a
collected_dynamic_variables
field that contains dynamic variables gathered during the conversation . Here's what you'll see in the call response:
Copy code
json
{
  "collected_dynamic_variables": {
    "last_node_name": "Test node"
  },
  "call_analysis": {
    "call_summary": "The agent called the user to ask question about his purchase inquiry. The agent asked several questions regarding his preference and asked if user would like to book an appointment. The user happily agreed and scheduled an appointment next Monday 10am.",
    "in_voicemail": false,
    "user_sentiment": "Positive",
    "call_successful": true,
    "custom_analysis_data": {}
  }
}
You can access this data through three methods [(2) ]() : 1. Dashboard - Visual interface for quick access and review 2. Webhook - Real-time notifications with analysis results 3. Get Call API - Programmatic access to call analysis data The
collected_dynamic_variables
field is available after the call ends and contains the dynamic variables that were gathered during the conversation [(1) ]() .
​ To learn more, see the sources I considered: [[1] Get Call](https://docs.retellai.com/api-references/get-call) [[2] Consume the analysis data](https://docs.retellai.com/features/post-call-analysis-consumption) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
r
@AI Evy How do I collect a dynamic variable when setting up the agent?
a
Thanks for the follow-up, @realee_23147. I'll get back to you soon.
### Answer ### Answer There are two main ways to collect dynamic variables when setting up your agent: 1. Using the Extract Dynamic Variables Tool You can add an Extract Dynamic Variables tool to your agent that allows it to extract values from user responses and save them as dynamic variables [(1) ]() . Here's how: 1. Add an Extract Dynamic Variable Tool to your agent 2. Configure variables by clicking "+Add" and filling in : - Variable Name – A short name to reference this variable - Description – A brief explanation of what this value should be - Variable Type – Choose from
Text
,
Number
,
Enum
, or
Boolean
- Enum Options - Options to choose from (only when type is enum) The available variable types are : - Text - Any word or sentence. Examples:
"headache"
,
"John Smith"
- Number - A numeric value. Examples:
42
,
98.6
- Enum - A value from a predefined list. Examples:
"Yes"
,
"No"
,
"Maybe"
- Boolean - True or false 3. Update your prompt to explicitly instruct when to invoke the extract variable function :
Copy code
When user states his name and phone number, please extract the information by calling the `extract_user_details` function.
2. In Conversation Flow If you're using Conversation Flow, you can use variables with the
{{var_name}}
syntax, and use Extract Variables nodes to capture state from conversations [(2) ]() . Setting Variables in Prompts You can also reference dynamic variables in your agent prompts using the
{{variable_name}}
syntax [(3) ]() . For example:
Copy code
"Hello {{user_name}}, I understand you're interested in {{product_name}}. How can I help you today?"
Dynamic variables can be used in prompts, begin messages, tool configurations, and call handling settings .
​ To learn more, see the sources I considered: [[1] Extract Dynamic Variables](https://docs.retellai.com/build/single-multi-prompt/extract-dv) [[2] Discord message from @rkrausse on 2025-08-20](https://discord.com/channels/1186424376300679209/1186462578310910112/1407859048426115163) [[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.