Variables

What are variables

Variables are placeholders for information that is part of your bot, user or conversation. Variables are defined by the platform, the skills that are installed in your bot, or by you as a flow builder. Variables hold information that can be used inside your conversations. Like Bot is the variable that holds the title of your bot and Purpose holds the description. Both fields are maintained on the Identity within your bot's settings.

Variables tab

The variables tab shows the variables that can be used inside your flows. The platform variables and the builtin variables of your installed skills are displayed at the bottom. The variables that you defined yourself, called Custom variables, are displayed at the top.

Using variables in your flows

There are two ways of using the variables inside your flows.

Method 1 - Copy the variable to your clipboard

Click on one of the variables in the Variables tab to copy the variable to your clipboard. You can then paste the variable inside any of the compatible text fields of your flow to use the selected variable.

Method 2 - Select the variable with short key /

Type a / in the text field you want to use a variable and select the variable from the drop down.

Creating custom variables

Custom variables can be created implicitly while assigning them to a flow node or explicitly by adding a new variable in the Variables tab.

Method 1 - Create a new variable in the variables tab

New variables can be created using the Add button in the Variables tab.

The add button will popup a small form to define the variable details. The following details can be defined.

PropertyDescriptionExplanation

Label

Display name of the variable

Name

Technical name of the variable

This is the identifier of the variable used in the underlying bubblescript.

Type

Data type

To help the system understand what type of data can be stored in this variable. Choices are string, boolean, number, datetime, date.

Description

To explain the purpose of the variable

Method 2 - Create a variable while assigning

As a flow designer you can also store information in variables yourself as a result of an Ask node. For instance, the Ask Open allows you to ask an open question to a user. The answer is then stored in a variable you define in the Assign to field. Then in a later Flow node you can use this custom variable using the methods described above.

When the variable is created while assigning in a Flow node as displayed above, the variable will not have any of the other variable properties filed, like label, description and type. To add this later you can go to the variable tab and click on the edit buton.

Native string interpolation

Older skills are configured using native string interpolation using the elixir syntax. This still works for backwards compatibility reasons. Please migrate your flows to the new method whenever possible.

Data captured in variables can also be used in your flows using the native elixir string interpolation syntax:

#{variable}

In the following example the name field is captured using the ask name node and then the next step is a node type say which embeds the name in the text: "Nice to meet you #{name}".

Embedding user variables

Fields that are stored in the user object can be embedded by using the user object reference syntax. For instance embedding the name of the user in a text:

#{user.first_name}

Last updated