uppercutcr
10/25/2025, 1:08 AMAI Evy
10/25/2025, 1:08 AMAI Evy
10/25/2025, 1:08 AMAI Evy
10/25/2025, 1:08 AMretell_llm_dynamic_variables must be strings [(1) ]() . Numbers, booleans, or other data types are not supported . This could be causing your variables to be dropped if they're not properly formatted as strings.
Variable Handling:
When dynamic variables have no assigned value or are improperly formatted, they remain in their raw form with curly braces intact . For example, if user_name is not provided, the prompt "Hello {{user_name}}, how can I help you today?" will remain as "Hello {{user_name}}, how can I help you today?" .
API Implementation:
When using the Create Phone Call API, you set variables in the retell_llm_dynamic_variables field like this [(2) ]() :
json
{
"user_name": "John Smith",
"product_name": "Premium Plan",
"account_status": "active"
}
Troubleshooting Steps:
1. Verify all your prompt_ variables are being sent as strings in your n8n payload
2. Check that your n8n expressions are actually evaluating and not sending null values
3. Ensure the variable names match exactly between your API call and your agent configuration
The documentation doesn't specify limits on the number of variables or character limits per variable. Since your simple variables (email, name, phone_number) are working but the longer prompt_ variables aren't appearing, this suggests the issue is likely in your n8n data structure or string formatting rather than Retell API limitations.
I'd recommend first checking your n8n payload to ensure all 30 prompt_ variables are being sent as properly formatted strings.AI Evy
10/25/2025, 1:08 AMuppercutcr
10/25/2025, 1:12 AMuppercutcr
10/25/2025, 1:12 AMAI Evy
10/25/2025, 1:12 AMAI Evy
10/25/2025, 1:13 AMretell_llm_dynamic_variables object is exactly right [(1) ]() [(2) ]() . The documentation confirms that dynamic variables must be passed in the retell_llm_dynamic_variables field when using the Create Phone Call API [(2) ]() .
A few additional points to ensure success:
- All values in retell_llm_dynamic_variables must be strings
- Variable names are case-sensitive and must match exactly between your API call and agent configuration
- The spaces around variable names will be trimmed when evaluating the variable
Your corrected structure should now properly pass all 24 prompt variables to your Multi-State Agent, and they should appear in the call log's Dynamic Variables section.AI Evy
10/25/2025, 1:13 AMretell_llm_dynamic_variables object [(1) ]() [(2) ]() .
Your corrected structure is the proper way to format the Create Phone Call API request [(1) ]() . Here's the correct format based on the documentation:
javascript
import Retell from 'retell-sdk';
const client = new Retell({
apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const phoneCallResponse = await client.call.createPhoneCall({
from_number: '+14157774444',
to_number: '+12137774445',
}) ;
console.log(phoneCallResponse.agent_id) ;
For the retell_llm_dynamic_variables field specifically, the documentation shows this example structure :
json
{
"user_name": "John Smith",
"product_name": "Premium Plan",
"account_status": "active"
}AI Evy
10/25/2025, 1:13 AMAI Evy
10/25/2025, 1:13 AMAI Evy
10/25/2025, 1:40 AMuppercutcr
10/25/2025, 1:40 AMAI Evy
10/25/2025, 1:41 AMprompt_1, prompt_2, etc.) in the retell_llm_dynamic_variables object [(1) ]() . The documentation shows this is an object for "optional dynamic variables in key value pairs of string that injects into your Response Engine prompt and tool description" . Custom variable names are fully supported as long as they're properly nested within this object.
String Requirements:
All values in retell_llm_dynamic_variables must be strings [(2) ]() . The documentation specifically states that "All values must be strings. Numbers, booleans, or other data types are not supported" .
JSON Escaping:
For proper JSON formatting, special characters like quotes must be properly escaped. When your content contains Did you say "yes"?, it should be escaped as Did you say \"yes\"? in the JSON payload to prevent syntax errors [(3) ]() . A Discord user encountered a similar issue with JSON formatting in retell_llm_dynamic_variables and received a 400 error stating "must be object" when the JSON wasn't properly formatted .
Recommended Method:
Using JSON.stringify() on your data before placing it in the payload is the recommended approach to handle special characters, quotes, and line breaks automatically. This ensures proper escaping without manual string manipulation.
Here's the correct structure from the documentation [(1) ]() :AI Evy
10/25/2025, 1:41 AMjavascript
import Retell from 'retell-sdk';
const client = new Retell({
apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const phoneCallResponse = await client.call.createPhoneCall({
from_number: '+14157774444',
to_number: '+12137774445',
}) ;
console.log(phoneCallResponse.agent_id) ;
Your retell_llm_dynamic_variables should look like this example :
json
{ "customer_name": "John Doe" }
Make sure all your prompt_1, prompt_2, etc. variables are properly JSON-escaped strings within the retell_llm_dynamic_variables object.AI Evy
10/25/2025, 1:41 AMAI Evy
10/25/2025, 1:41 AM