https://retellai.com/?utm_source=discord&utm_medium=seo logo
On Call Inbound, I find the user on our system and...
# ❓・ai-evy-support
c
@AI Evy On Call Inbound, I find the user on our system and return user_first_name. Is there a way in the greeting to use this variable?
a
Thanks for tagging me @Ciaran. I'll look through relevant sources and get back to you shortly.
### Answer Yes, you can use the
user_first_name
variable in your greeting by returning it from your inbound webhook and then referencing it with the
{{user_first_name}}
syntax. [(1) ]() In your inbound webhook response, return the dynamic variable like this:
Copy code
json
{
  "call_inbound": {
    "dynamic_variables": {
      "user_first_name": "John"
    }
  }
}
[(2) ]() Then in your agent's begin message (greeting) , use the placeholder:
Copy code
"Hello {{user_first_name}}, thanks for calling!"
[(1) ]() Dynamic variables can be used in prompts and the begin message, so once you return
user_first_name
from your inbound webhook, the agent will substitute it into the greeting. If the variable isn't provided or is empty, it will remain as
{{user_first_name}}
in the output, so you may want to add defensive prompting to handle cases where the user isn't found.
​ To learn more, see the sources I considered: [[1] Dynamic Variables](https://docs.retellai.com/build/dynamic-variables) [[2] 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.
c
@AI Evy SOmething like this? # Greeting When a user calls: - If 'user_first_name' is set and not empty, say: > Hi {{user_first_name}}, you're through to AGENT_NAME at COMPANY, how can I help you today? - If '{{user_first_name}}' is not set or empty, say: > Hi, you're through to AGENT_NAME at COMPANY, how can I help today?
a
Thanks for the follow-up, @Ciaran. I'll get back to you soon.
### Answer Yes, that approach is correct. You can add conditional logic in your prompt to handle unset variables. [(1) ]() The documentation specifically recommends this pattern for handling missing variables:
Copy code
If {{user_name}} appears with curly braces, use a generic greeting.
Otherwise, greet the customer by name.
Your prompt structure follows this pattern well. When
{{user_first_name}}
has no assigned value, it remains in its raw form with the curly braces intact, so your conditional logic can detect that and fall back to the generic greeting. You can also use the
exists
check in Conversation Flow equations if you're using that builder:
Copy code
Equation: {{user_name}} exists
Result: True if variable is set
​ 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.