https://retellai.com/?utm_source=discord&utm_medium=seo logo
c
@AI Evy SIngle prompt. call_inbound webhook, I set user_name, user_postcode, user_id etc. I start the call, these variables are set but if I go, 'where is my X?', the agent is always asking for authentication? Its as if single prompt doesn't know about these variables from the call_inbound? - Before speaking about X, you must have identified the user on our system. If you don't have them identified (e.g. no '{{user_id}}'), go to **Authentication Flow**: ask for postcode only first (do not ask for name yet), then look up the user; if no user found, then ask for DOB and surname and look up again. Do not give X or account-specific information until the user is matched. - If '{{user_id}}' does NOT exist: > Go to Authentication Flow (postcode first → if no user found, then DOB + surname). Do not proceed with X enquiries until the user is authenticated. - After authenticating (or if '{{user_id}}' already exists): Call the user lookup tool with the details you have (postcode, or postcode + DOB + surname), get the user's record, then call 'findLatestX' with the numeric user id from that lookup response (the 'id' field) - never pass a composite string like "Name_DOB_Postcode"; the system expects the actual id returned by the lookup.
a
Thanks for tagging me @Ciaran. I'll look through relevant sources and get back to you shortly.
### Answer --- The issue is likely with your inbound webhook response structure. For inbound webhooks, dynamic variables must be nested under
call_inbound
, not returned at the top level as
retell_llm_dynamic_variables
. [(1) ]() Your webhook should return this structure:
Copy code
json
{
  "call_inbound": {
    "dynamic_variables": {
      "user_name": "John",
      "user_postcode": "12345",
      "user_id": "abc123"
    }
  }
}
Not this:
Copy code
json
{
  "retell_llm_dynamic_variables": {
    "user_name": "John",
    "user_postcode": "12345",
    "user_id": "abc123"
  }
}
Even if your logs show the variables being returned, if they're at the wrong nesting level, the agent won't receive them—which explains why your prompt's condition
no '{{user_id}}'
keeps triggering the authentication flow. Additionally, when a dynamic variable has no assigned value, it remains in its raw form with the curly braces intact (e.g.,
{{user_id}}
stays as literal text) . [(2) ]() To verify, check your webhook response format and ensure variables are nested under
call_inbound.dynamic_variables
.
​ To learn more, see the sources I considered: [[1] Inbound webhook returns retell_llm_dynamic_variables but agent doesn't receive them](https://community.retellai.com/t/inbound-webhook-returns-retell-llm-dynamic-variables-but-agent-doesnt-receive-them/733) [[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.
c
@AI Evy It does that. json = { "call_inbound": { "dynamic_variables": { "christmas": (is_admin ? false : is_christmas).to_s, "new_years_day": (is_admin ? false : new_years_day).to_s, "out_of_office": (is_admin ? false : out_of_office).to_s, .... OTHER VARIABLES } } } return json When it was a conversation flow, it was working and using them correctly, but since moving it to single prompt as it was better at actually conversing, its not actually setting it?
a
Thanks for the follow-up, @Ciaran. I'll get back to you soon.
### Answer Your webhook response structure looks correct. The inbound webhook works the same way for both Conversation Flow and Single/Multi Prompt agents—dynamic variables returned under
call_inbound.dynamic_variables
should be injected into the call. [(1) ]() A few things to check: 1. Verify the webhook is actually being called - Check your Detail Logs in the dashboard to confirm the inbound webhook is firing and returning the expected response. [(2) ]() 2. Ensure your webhook returns a 2xx status code - The webhook has a 10-second timeout. If no success status is received, it retries up to 3 times. [(1) ]() 3. Check the Data tab for the call - After a test call, look at the "Data" tab to see if "Extracted Dynamic Variables" shows your variables. If it shows "No Extracted Dynamic Variables," the webhook response isn't being processed correctly. [(3) ]() 4. Confirm variables are defined in agent settings - Make sure the dynamic variables (
user_name
,
user_postcode
,
user_id
, etc.) are defined in your Single Prompt agent's settings. 5. Return valid values for unknown callers - If your CRM lookup returns no results, you still need to return a valid webhook response. One workaround is to return placeholder values (e.g.,
"user_id": ""
or
"user_id": "unknown"
) rather than omitting the field entirely. [(4) ]() Can you check the Detail Logs for a specific call and confirm what the webhook response shows?
​ To learn more, see the sources I considered: [[1] Inbound webhook](https://docs.retellai.com/features/inbound-call-webhook) [[2] Inbound calls dynamic variables webhook is not called](https://discord.com/channels/1186424376300679209/1336373687288594442) [[3] Inbound webhook returns retell_llm_dynamic_variables but agent doesn't receive them](https://community.retellai.com/t/inbound-webhook-returns-retell-llm-dynamic-variables-but-agent-doesnt-receive-them/733) [[4] Discord message from @yves_69297 on 2025-01-16](https://discord.com/channels/1186424376300679209/1186462578310910112/1329371703100571778) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
c
@AI Evy Yes. I can see that information... christmas: false found_user: true intro: Hi Ciaran, you're through to Agent at company, how can I help you today? new_years_day: false out_of_office: false should_end_call: false user_dob: 23/02/1976 user_email: ciaran@comapny.co.uk user_first_name: Ciaran user_id: 1 user_last_name: Test user_name: Ciaran Test user_number: 1234567890 user_phone: 07876543212 user_postcode: AB1 5AS user_status: Admins
a
Thanks for the follow-up, @Ciaran. I'll get back to you soon.
### Answer Since the dynamic variables are clearly showing in your call data (including
user_id: 1
) , the webhook is working correctly and the variables are being received. The issue is with your prompt logic—specifically how you're checking for the existence of
{{user_id}}
. The problem is likely in your conditional check. When you write
no '{{user_id}}'
in your prompt, the LLM may not correctly interpret whether the variable has a value. The variable exists and has a value (
1
) , but your prompt phrasing might be confusing the agent. Try adjusting your prompt to be more explicit: - Instead of checking if
{{user_id}}
"exists," check for a specific condition like: -
If {{user_id}} equals "" or {{user_id}} equals "unknown"
- Or use a separate flag variable like your
found_user: true
which is already set Since you already have
found_user: true
being returned, you could rewrite your authentication logic to check that variable instead: - If
{{found_user}}
is
false
or empty:
Go to Authentication Flow - If
{{found_user}}
is `true`:
Proceed with the user's request using
{{user_id}}
This approach gives the LLM a clearer boolean condition to evaluate rather than trying to determine if a variable "exists." [(1) ]() You might also consider returning a special value like
NOT_FOUND
from your webhook when no user is matched, making it easier to write the logic in the prompt. [(2) ]()
​ To learn more, see the sources I considered: [[1] Inbound webhook](https://docs.retellai.com/features/inbound-call-webhook) [[2] Discord message from @yves_69297 on 2025-01-29](https://discord.com/channels/1186424376300679209/1186462578310910112/1334012215241478206) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
c
@AI Evy The prompt - If {{found_user}} is false or empty: Go to Authentication Flow - If {{found_user}} is true: Proceed with the user's request using {{user_id}}. Call findLatestX to get the latest X. The call call_inbound variables christmas: false desc: Terminate found_user: true Agent 0:10 No problem at all, we can check that for you. To pull up your account, can you please tell me your postcode?
a
Thanks for the follow-up, @Ciaran. I'll get back to you soon.
### Answer The issue appears to be a prompting problem rather than a webhook/variable injection issue. Your variables are clearly being received (
found_user: true
is showing in the call data) , but the LLM isn't following your conditional logic correctly. This is a known challenge with Single/Multi Prompt agents—when tools aren't being triggered as expected or conditional logic isn't followed, Retell recommends giving explicit trigger conditions in the system prompt and strengthening the "Tool Usage Instructions" section with clear rules. [(1) ]() A few approaches to try: 1. Make the condition more explicit and direct: Instead of relying on the LLM to interpret "if true/false," try phrasing it as a strict rule at the very top of your prompt:
Copy code
CRITICAL: {{found_user}} = true means the user IS authenticated. Do NOT ask for postcode or any authentication. Proceed directly to helping them.
2. Use the LLM Playground to debug: Test your prompt with the exact variable values (
found_user: true
) and see how the LLM interprets your instructions. You can use "Regenerate 10 Times" to test consistency and adjust temperature if needed. 3. Consider splitting logic: If the agent keeps defaulting to authentication despite clear variables, you might need to restructure your prompt so the "authenticated user" path is the default, with authentication only triggered by an explicit negative condition. The fact it worked in Conversation Flow but not Single Prompt suggests the LLM in Single Prompt mode needs more explicit, direct instructions to follow conditional paths reliably.
​ To learn more, see the sources I considered: [[1] Tools not being triggered](https://community.retellai.com/t/tools-not-being-triggered/201) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
c
@AI Evy Managed to solve it. We have a controller (what I like to call it) where we handle the call i.e: go to this agent X or agent Y IF they want to speak about how it works for example. What I have to do is... - set_inbound_variables: Once you are transferred to or started, call this to set the variables from the call_inbound webhook And set_inbound_variables will set the variables because I think the variables are getting lost between agents.
a
Thanks for the follow-up, @Ciaran. I'll get back to you soon.
### Answer Glad you found a solution! Your diagnosis is correct—dynamic variables don't automatically persist when transferring calls between agents. [(1) ]() When transferring to another agent, you need to explicitly pass dynamic variables to preserve them. One approach is to store the information and use an inbound webhook or custom function to retrieve it in the receiving agent. Your workaround of creating a
set_inbound_variables
function that the transferred-to agent calls immediately is a valid pattern for re-populating the context that was set in the original
call_inbound
webhook. For reference, another community member noted a similar issue where
{{user_number}}
wasn't working correctly after agent transfers—the variable context wasn't being preserved across the transfer.
​ To learn more, see the sources I considered: [[1] {{user_number}} - system dynamic value is not working after chat transferred another agent](https://community.retellai.com/t/user-number-system-dynamic-value-is-not-working-after-chat-transferred-another-agent/730) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
c
@AI Evy How do I go about setting the current time on London/UK?
a
Thanks for the follow-up, @Ciaran. I'll get back to you soon.
### Answer Use the system default dynamic variable with the timezone specified for London/UK:
Copy code
{{current_time_Europe/London}}
[(1) ]() This will return the current time in the Europe/London timezone (e.g., "Thursday, March 28, 2024 at 11:46:04 PM GMT") . You can also use
{{current_hour_Europe/London}}
if you only need the current hour (e.g., "3 PM GMT") . For a 14-day calendar in London time, use
{{current_calendar_Europe/London}}
. Just add the variable directly in your prompt where you need the time reference.
​ To learn more, see the sources I considered: [[1] 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.