"Variable" is temporary storage for your data. They can be used for storing data fetched from the end-user. Moreover, you can also use variables to validate if the end-user is a first time user and much more.
Why user Variables?
Suppose you have a script in which you ask the end-user, their age. You may use their age to show products that are relevant to that age group. However, you cannot implement this flow unless you store the incoming data from the user (age), somewhere, so you can use it later. Variables come in handy at this time, you can create a variable and store the user age in that variable, later you can validate the value of that variable ( by using this element).
Variable Types
RepliedAI uses two types of variables
- System variables.
- User Variables.
System Variables
System variables are pre-defined variables. You can use the following "System Variables"
- _UserName : This variable stores the end-user name if they have configured any. If the end-user has not configured any name, this variable will have a default value 'user'
- _CatalogueItem : This variable stores the product ID of the selected product from the conversation element "Product Catalogue". This variable will only be populated if the "product catalogue" is displayed. If the end-user clicks on any of the items in the catalogue, this variable gets populated with the product id of that variable. You can then validate this variable using this element to confirm the value of the product ID.
- _FirstTimeUser : This variable will have a value 'true' if the end-user is using your chatbot for the first time. If the end-user is a returning user the variable will have a value of 'false'.
- _UserRegister1 : This variable does not have an initial value. This can be used by you to store any information. Since this variable is
"User variable" and "_UserRegister1" are used by you to store the information, this variable(_UserRegister1) is unique in a way that it does not require to send any message to the user, unlike the other user-defined variables.
User Variables
User variables are created by the user(you) to store any information fetched from the end-user.
Configuring user variables:
User-defined variables always store the information provided by your end-user, that is the reason all user-defined variables need to start with a query statement based on which, end-user will provide the information.
These variables can be declared by following these steps.
- Log into repliedAI console click here.
- Navigate to the "My bots" section.
- If you have not created any bot yet, follow this tutorial to create your first bot click here. If you already have a bot then go to the bot design studio by clicking on this button.
- Once you are in the bot design studio, add conversation Element "Save user input" into your chatbot design.
- On the user-defined variables settings page, type in the required information:
- User prompt: Type the question or statement that will prompt end-user to provide the information
- Data Field Name: This is the name of the variable, type-in a unique name so that you can reference it later.
- Data Retained For Type the number of days up to when you want the data to be retained. e.g. if you type 1, then the data will be retained for 1 day.
Comments
Post a Comment