andrew
11/25/2024, 12:09 AMVapi
11/25/2024, 12:12 AMVapi
11/25/2024, 12:12 AMname variable is set and use it in the greeting. If the name variable is not set, the assistant would default to a generic greeting. Here's a pseudo-code example of how you might set this up:
if (name is provided) {
greeting = "Hello, am I speaking with {{name}}?"
} else {
greeting = "Hello, whom am I speaking with?"
}
When starting the call, you would pass the assistantOverrides with variableValues to the API or SDK. If you have the customer's name, you would include it; if not, you would omit it, and the assistant would use the default greeting.
Here's how you might pass the variable when starting the call:
{
"variableValues": {
"name": "John" // Only include this if the name is known
}
}
If the name is not known, you would simply not include the name key in the variableValues, and the assistant would use the conditional logic to choose the appropriate greeting. This way, you can maintain a single assistant that adapts to the information available.Vapi
11/25/2024, 12:13 AMVapi
11/25/2024, 12:13 AM