Global Variables
This is a quick guide on how to use the predefined global variables on the botbaba platform to recall the variables anytime in the bot flow. This makes it easy for a user to perform actions which they very often want to perform and that too without any lengthy process, all they have to do is just define the variable where needed and recall them, again and again, using “#variable#”
So we have two categories of predefined variables that are General and E-commerce.
Note: All the Global Variables are case-sensitive.
General Variables:
#Welcome#: This variable can be used when taking any input in the welcome message
Here you can see we are taking input from the user, so now whatever input we receive here can be recalled that using “#Welcome#“(W should be mandatorily capital). Here we have asked for the name as input so we can recall the name of the user in the bot flow where we want to address the user with his/her name personally.
#greeting#: This variable can be used when we want to greet the user with good morning, good afternoon, or good evening.
We will use this in the edit block of the bot wherever needed in the flow
#WAName#: This variable lets you address the user by their WhatsApp username.
#WANum#: This allows you to show the user their registered WhatsApp number.
#CurrentDate#: This allows you to show the user the current date whenever required in bot flow. And the format will be dd-mm-yyyy
#CurrentTime#: This variable allows you to show the user the current time in the bot flow.
#CurrentDay# – This can be used if you want to show the user the current day in the bot flow.
#CurrentMonth# – This variable allows you to let the user view the current month in the bot flow.
#Timestamp#: This variable lets you show the user on what time specifically. And the format will be dd-mm-yyyy hh:mm:ss
#ConvId#: ConvId stands for Conversation Id. This variable lets you access the unique Id for any conversation.
#NextDate#: Using this variable you can automatically fetch the date of the next day.
#NextDay#: Using this variable you can fetch and show the next day in the bot flow. Like if the bot is being run on Monday and we recall this variable it will show Tuesday there in place of the variable.
#NextMonth#: Using this variable you can show the user which is the next coming month. So if the bot is being run in June and if we recall this variable somewhere it will show July.
Let’s understand a few variables with an example:
#Welcome# variable example:
Now we will show you how to use and recall the variable
This is how we recall the variable #Welcome# and like we asked for the name in the given example we will now show you how exactly it looks o the chatbot.
This is how #Welcome# variable is used and like this other variables can be used accordingly.
#greatings# variable example:
Let us see how we can use this variable, so firstly we use this in the edit block of the bot wherever we need it in the flow
Here, you can see we have recalled the variable #greeting#, now we will see how it works on the chatbot
This way we can use the #greeting# variable and use it in the bot flow.
E-commerce Variables:
#EComReceipt#: After the user has selected and submitted some items to the cart, this variable will display the receipt. (Only works to display the receipt inside the web bot)
#TotalAmount#: You can access the total amount of an order using this variable. Total amount = Gross Amount + Delivery Charges + Taxes (if any)
#GrossAmount#: You can access the gross amount of an order using this variable. The Gross amount is the sum of all the items in the cart.
#EComItemCount#: This variable allows us to access the number of items in a cart/order.
#EComCartId#: This variable will return the Order ID and is useful to add it in self notifications and customer notifications.
#GrossAmountWithTax#: This variable includes Gross Amount + Tax but without Delivery Charges.
#EComOrderJson#: This variable provides the details of the order made in the JSON format.