Skip to main content

Get started with variables

Overview

Variables allow you to put personalized information into your conversations, so you can create flexible, customized conversations with your Ada chat bot. This topic will take you through a variety of methods you can use to set variables.

What is a variable?

A variable is a reusable piece of data that can be referenced in an Answer. Think of a variable as a placeholder for information that is unique to each person who visits your bot.

Example: Ask for a customer's name and have the bot refer to that person by name going forward.

Dashboard ViewChatter View

Local variables are specific to the Answer in which they are created and cannot be used in other Answers. Local variables are blue:

Global variables can be used across all Answers. Information gathered as a global variable need only be collected once and can be re-used in other relevant Answers. Global variables are colored green:

Metavariables are chatter-specific variables, collected without the chatter providing the information directly. They include information such as a chatter's browser type, browser version, and IP address (for messaging conversations) and phone number, city, and country (for voice conversations). Metavariables are colored purple:

Sensitive variables can be used to handle sensitive customer information. A sensitive variable's value is always redacted in the Ada dashboard, and is permanently deleted after 24 hours. When creating sensitive variables, select Availability > All Answers (Redacted). Sensitive variables are colored yellow:

Collect and manage variable data

There are several ways to save and manage variable data:

  • Use a Capture block to request information directly from chatters and save it in a variable.

  • Use the Set Variable block to manage variable data internally.

  • Use the HTTP Request block to pull information from a public or private API. This information can be either static information (e.g. name or phone number) or dynamic information (e.g. price of Bitcoin, an account number, an array of recent orders).

  • Use your Embed2 script to pass web metadata into your bot as custom metavariables.

important

Variables are limited to 100,000 characters. Particularly when you're saving all or part of an API response as a variable, take care that you don't exceed this limit. If you do, you may start seeing errors, because your bot might not be able to correctly parse your variable content.

Set fallback text

In case there is an error and the personalized data can't be displayed, it's important to set fallback text for every variable you use. That way, your bot still has something to show chatters if the variable doesn't populate properly.

  1. Click on the variable where you've injected it into your Answer block. The Options pop-up displays.

  2. In the Options pop-up, under Fallback Text, add text that you would like to appear in the event of an error.

Learn more about metavariables

Metavariables are the purple variables you see in the Variable Manager, and that you can add to Answer blocks when building Answers on the Ada dashboard. They contain chatter information retrieved and saved automatically by your bot, without having to collect it from a chatter directly.

Every bot starts with metavariables related to the chatter's bot conversation, as well as those gathered from the chatter's browser; however, you have the option to pass additional chatter data to the bot from your own database using an Embed script setting called setMetaFields. This method enables the passing of details, such as name, email, ID, and anything else you'd like to pass to the bot. Information passed this way is called metadata. The bot then saves the metadata as metavariables for you to use.

note

Whether or not you require chatter authentication before passing their metadata is up to you. Keep that in mind when adding the setMetaFields setting to your bot installation on your platform. See our article about Let chatters sign into your website for more information.

In the Conversations view, when you select a conversation, you can see a complete list of metadata that has been collected for that chatter. Global variables that capture names, emails, or phone numbers will also replace "Anonymous" in the Conversations view.


Have any questions? Contact your Ada team—or email us at .