{{customer.number}} variable not recognized
# prompt-tip
a
We are using the phone number to send to our backend. By default, we use the {{customer.number}}. However, in some situations, this is not available (like testing from web). In such cases, we would like for the agent to collect the phone number from the user. Currently, we have a prompt that instructs the agent that if the number is null or not available(like testing on web), then ask the phone number to the user. However, the agent does not understand this. Even if the phone number is missing, does not ask the user, and passes the literal string {{customer.number}} instead of a 10-digit number to the tool. How do you fix this problem of identifying when {{customer.number}} is empty? Is the problem with the prompt that we guide to the agent, or is the problem in the default variable recognition?
a
Best solution is to just always have the AI confirm a number with the customer before sending it. I.e dont just send the {{customer.number}} variable to the tool, but rather have it ask something like "Just to confirm, your phone number is: {{customer.number}}, correct?" then take the REPLY as a variable rather than sending {{customer.number}} itself.
If they say yes, make the llm copy down {{customer.number}} as another variable such as just customer_number or something, and if they say no, whatever they correct it to be just store as customer_number, if that makes sense
a
How do you take the reply as a variable in real time during run time? Also if the number is actually not a valid number or a literal string like {{customer.number}} since the call was made on web, the agent will read no number but a string. How do you handle this case?
r
Hi aqsafulara, For personalizing voice assistant messages with customer-specific information, you can use dynamic variables such as
{{customer.number}}
and any other property by using
{{customer.propertyName}}
. You can personalize messages by configuring your server to recognize incoming calls and respond with customer data. Here's a quick example of how you might set this up: 1. **Identify the Caller**: Use the calling number to look up customer information in your database. 2. **Respond to Vapi**: Return the relevant customer data in the required format. For instance, if you want to include the customer name and number in a greeting, you'd configure:
Copy code
json
{
  "assistantId": "your-assistant-id",
  "assistantOverrides": {
    "variableValues": {
      "customerName": "John Doe",
      "customerNumber": "+1234567890"
    }
  }
}
Make sure your server is set up to respond to Vapi's requests with this kind of data. For more details, you can refer to the [Personalization with user information documentation](https://docs.vapi.ai/assistants/personalization).
a
Hi @aniah Thanks for responding. I’m already using the variable {{customer.number}} in the call, however the challenge is the agent is not able to identify in situations where the number is empty. Same goes for other variables to determine the call flow dependent on that value of that variable. Is there a way to check the value of that variable in call logs?
r
You can modify the assistants behavior by changing the the prompts instructions on how to handle a value when its not present/read. If you would like, you can provide a call id and we will review your current prompt and suggest some changes