Templates
Templates allows you to create dynamic instructions and first messages in your Voice Bot by utilizing variables and conditions. This enables you to personalize conversations, adapt responses based on user data or API results, and pass dynamic data to function parameters.
Use Cases
- Personalize the bot’s instructions to the AI model.
- Restructure output from APIs and provide personalized instructions or output based on the result.
- Use variables in function parameters to pass data like phone numbers or IDs.
Variables
Variables are placeholders that are replaced with actual values during runtime. They are enclosed within double curly braces {{variableName}}
.
In this configuration, the system will pull the actual value associated with {{firstName}}
from a Phonebook or CRM system. Once substituted, the modified message will then be played back to the user.
Predefined variables
Variable Name | Description |
---|---|
{{name}} | Full name of the caller, if available (e.g., John Doe) |
{{firstName}} | First name of the caller, if available (e.g., John) |
{{lastName}} | Last name of the caller, if available (e.g., Doe) |
{{phoneNumber}} | Phone number of the caller (e.g., +34613581608) |
{{sessionId}} | Unique ID of the voice bot session (e.g., 1727940545.3.0) |
{{botId}} | Bot ID that handles the voice session (e.g., n0bMV55kFGO5) |
{{callId}} | Unique Call ID (e.g., 1727940545.3) |
{{flowIndex}} | Call Flow Index (e.g., 0) |
{{language}} | Language (e.g., English) |
{{languageCode}} | Language Code (e.g., en-US) |
Conditions
Conditions allow you to control the flow of the template by including or excluding content based on whether certain conditions are met. This is useful for personalizing messages when specific data is available.
Syntax
Example
In this example, if {{firstName}}
is available, the bot greets the user by their first name. If not, it displays a generic greeting.
You can also extend conditions using else if to handle multiple cases.
Loops
Loops allow you to iterate over arrays or lists of data, such as results from an API call, and dynamically generate content based on each item.
Loops are useful when you need to display a list of items or process each item in a collection. For example, you might retrieve a list of transactions from an API, but you only want to pass specified fields of the response to the model.
Use Cases:
- To include or exclude certain parts of the information from the API in the response.
- To restructure output from your API before presenting it to the user or the model.
Syntax
Example