Dynamic Variables
In programming, a dynamic variable is a variable whose value is determined by the user when the program is run.
In botbaba, a user’s input (response or message) can be stored in a dynamic variable which can then be recalled when required anywhere in the chat flow.
How to use Dynamic Variable?
- Declare a variable
- Recall a variable
Let’s start by declaring a dynamic variable:
After opening your Bot, go to Edit the block and you will see screen like this
You can now see the box asking you to enter the name of your dynamic variable.
Here, we are taking example of contact number so we can name the dynamic variable as “number”.
Now, let’s recall this variable in next block
The number which was given as response in the previous block will now be recalled for confirmation in this block.
To recall a particular variable, use #variable# in any of the bot messages.
I have recalled the mobile number collected in the next block by writing #number# in the next message. My message was Confirmation: Your contact number is #number#
and the output will look like this:
You can use variables (dynamic or global) anywhere on our platform wherever you see this icon in a text box =>