https://retellai.com/?utm_source=discord&utm_medium=seo logo
why this json isn't valid to create a retell call ...
# ❓・ai-evy-support
m
@AI Evy why this json isn't valid to create a retell call vía API? { "from_number": "+13174636464", "to_number": "+13174636464", "override_agent_id": "agent_e63b71cc1ac20085ad01468225", "retell_llm_dynamic_variables": { "first_name": "{{ $('get memory records1').item.json.user_first_name }}", "partner_name": "NO PARTNER", "appointment_date": "{{ $('Airtable16').item.json.schedule_date }}", "appointment_time": "{{ $('Airtable16').item.json.schedule_time }}", "appointment_location": "{{ $('Airtable16').item.json.location }}", "tags":"appointment_true", "phone": "{{ $('Airtable16').item.json.phone_number }}", "email": "{{ $('Airtable16').item.json.email }}", "memory": "{{ $('get memory records1').item.json.memory }}" } // This is the error: [ { "length": 1, "error": "JSON parameter needs to be valid JSON" } ]
a
Thanks for tagging me @mariecurie. I'll look through relevant sources and get back to you shortly.
​ To learn more, see the sources I considered: [[1] Create Phone Call](https://docs.retellai.com/api-references/create-phone-call) [[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.
### Answer The JSON you're using has a syntax error that's causing the "JSON parameter needs to be valid JSON" error [(1) ]() . The problem is the inline comment
// This is the error:
at the end of your
retell_llm_dynamic_variables
object . JSON does not support comments . You need to remove that comment entirely . Here's the corrected JSON structure for creating a phone call :
Copy code
json
{
  "from_number": "+13174636464",
  "to_number": "+13174636464",
  "override_agent_id": "agent_e63b71cc1ac20085ad01468225",
  "retell_llm_dynamic_variables": {
    "first_name": "{{ $('get memory records1') .item.json.user_first_name }}",
    "partner_name": "NO PARTNER",
    "appointment_date": "{{ $('Airtable16') .item.json.schedule_date }}",
    "appointment_time": "{{ $('Airtable16') .item.json.schedule_time }}",
    "appointment_location": "{{ $('Airtable16') .item.json.location }}",
    "tags": "appointment_true",
    "phone": "{{ $('Airtable16') .item.json.phone_number }}",
    "email": "{{ $('Airtable16') .item.json.email }}",
    "memory": "{{ $('get memory records1') .item.json.memory }}"
  }
}
The
retell_llm_dynamic_variables
field accepts key-value pairs of strings that inject into your Response Engine prompt and tool description [(1) ]() [(2) ]() . Make sure your template expressions (the
{{ }}
syntax) are being evaluated by your automation tool before sending to the Retell API [(2) ]() .