Variables

Use variables to capture customer's information and save orders

By Adam Wen
April 29, 2021

Variables

Variables capture the information provided by chat users during the conversations. These values are used in the conversation between the chatbot and chat users as the conversation contents. Variables will be saved in the system even when chat users delete the conversations. In case the operator turns on the feature “Do Not Keep The Conversation History”, variable values will be updated when the chat user starts a new conversation (when chat users press the “Get Started” button).

Let’s say you want to confirm the shipping information. You can automatically insert the information of the chat user by using variables:

Shipment Details:

  • Name: {Full_name}

  • Address: {Address}

  • Phone: {Phone}

You can use variables in any part of the message by choosing them, the autocomplete will help you with inserting the variable values into the designed text.

Create Variables In order to create a Variable, you should go to Data penal (on the left-hand side of Bot Builder), click the “+” Add Variable button and fill in relevant information, then click Create. The new Variable will appear on the list under the Data panel.

Fields that you need to complete when you create a Variable are:

  • Name of the variable. It should be unique.

  • Data Type is the format of the variable. CloudIntern supports three data types: Text, Number and Date.

  • Description (optional) you can fill in relevant information to easily identify the variable.

  • Store Values As A List (optional) allows you to store values of the variable as a list.

  • Initial Value (optional) allows you to set an initial value. The result of this variable will yield in case its value is empty.

For example, you want to make a “Phone number” variable:

So, to save the answer from the chat user, you have to enable Expect User Response which is located at Properties (on the right-hand side of the Bot Builder, under the Preview button). That means the bot will repeat the question until it gets a valid phone number from the chat user. However, to add the value to a variable, there is one more step: using the Update Variables block in the flow (this action will be explained more in the User Responses part 2). You may want to take a look here as a simple example:

Update/ Delete Variables After creating variables, you may wonder about how to edit them. In order to update a Variable, click on the Variable which you want to edit, then click on the Update Variable button. You should pay attention to the Name and Type of a variable which is not able to change once the variable has been set up. There are several elements which could be changed: DescriptionInitial valueStore Values As A List.

You can choose to delete a variable in the shown up window by clicking on the Delete button.

Note: *You should consider carefully when deleting a Variable. Once the variable is deleted, there is no way to restore it and blocks which use this variable value may not work as expected.

User responses

The next element in Data penal is the User Responses. User Responses are responses from chat users. In other words, the user's first message/ reply/ interaction right after a block is called the response of that block. User Responses are such dynamic fields containing different data from specific chat users, such as email addresses, quantity of ordering items, etc. These information are stored within an end-user profile.

These values are stored under the name of the block, for example: the block’s name is Number of Items, the user response will be named as response.NumberofItems. The data will be stored only if the block is set to Expect User Response and chat users give a response. The values of User responses can not be modified unless the Block is triggered again. Let’s look at the example of Updating Variable “Phone number”, when setting up the “ask for phone number” block, you should enable Expect User Response:

Similar to Variables, in case the operator turns on the option Do Not Keep The Conversation History, user response values will be updated when the chat user starts a new conversation (when chat users press the Get Started button), or when the user comes back with the new answers.

Save User Responses As mentioned above, when you enable the Expect User Response option in the Properties panel, the response of chat users will be stored under the name of the block. Thus, you should name all blocks clearly and meaningfully to easily distinguish responses and search for hosted blocks.

In order to locate a block corresponding to the response captured on the Flow, you may go to the Data panel, click the Go To Block button next to that response.

Besides, there is a wide range of options to define the correct answer from chat users. For instance, you want a phone number but the chat user types a text. If this happens, the bot may show Validation Error Message and keep asking the question again until getting the right form response. You are able to choose the Response Validation, such as email, phone number, numbers, a web link, button, etc.

The photo below will show a simple example. In which the block asks for a chat user’s mail, the chat user must give a valid one to move on to another block.

User attributes

User Attributes are add-in information that you define for users in addition to the existing information provided by the system such as First Name, Last Name. Other information that is often added to users: birthday, address, phone number, etc. This information will disappear with the user you delete in the Audience section. You can read the detailed instruction on how to use this attribute in User Attributes.

Bot attributes

Bot Attributes are variables that define some information about the bot that stays the same across the business, such as the address, contact number or working hours. These bot attributes are consistent no matter who interacts with the bot.

Create Bot attributes Similarly to creating a Variable process, to make a bot attribute, you need to go to the Data panel, click on Add Variable (+), fill in the information (Name, Data type, Initial Value, Description) and Create.

Kindly notice that once the Bot attributes have been created, you are unable to edit Name and Data type.

Update/ delete Bot attributes To manage the Bot Attributes, you may go to the Data panel. To apply the bot variables in your messages, you can insert the variable in the left section of Flow Editor.

Deleting an attribute can be done similarly to a Variable.

To have a better understanding of the usage of Variables, please go to the following article to find out the answers.

Was this article helpful?