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 View

Chatter View

updated_dash_view_v2.jpg
chatter_view.jpg

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

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: greenvariable.png

Metavariables are specific to the individual chatter and can be found in all Answers. They include information such as a chatter's browser type, browser version, IP address, and so on. Meta variables are collected as part of the bot implementation process and not during a conversation. Information passed from your database to the bot as metadata will be stored as a Meta variable. Meta variables are colored purple: metavariable.png

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: Screen_Shot_2020-09-09_at_1.13.46_PM.png

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 API calls to pass information from your database to your bot as 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 Authentication 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.

Screen_Shot_2019-07-16_at_4.29.54_PM.png

Have any questions? Contact your Ada team—or email us at help@ada.support.