How to reset the variables in my chatbot

Resetting variables in my chatbot

You use {{…}} variables in the sequences of your chatbots, you assign them, increment, decrement etc…

You think it’s great, we do too, and you certainly use these variables in the “If…” condition feature to redirect users based on their actions.

However, you may sometimes need to “reset” your variables after several tests of your chatbot to get back to the conditions of a new user or to “reset” the path of a visitor. So you are wondering “Where is the “Reset” function for variables?”

In fact on BOTNATION AI to reset a variable you just have to assign it back its starting value, that is 0 for numbers and “nothing” for texts, the equivalent of “empty” in both cases.

➜ Discover Botnation and launch your chatbot easily!

Case in point:

I create a sequence “Counters” where I automatically increment 2 variables {{count_1}} and {{count_2}} and I also assign a text in the variable {{txt_1}} which will not change anymore.

These variables being newly created, automatically on the fly, the counters are at 0 for numbers and “empty” for text. I then display the result to see the changes.

To test my variables I assign a keyword, here “count”, which I test in my chatbot.

I see that variables are incremented at each test, the text is fixed.

I could then decide to use these variables to redirect users in my chatbot according to several visits to the same place to personalize a welcome message if the user regularly visits the bot or according to the number of correct answers to a quiz.

If at the end of the visit or the game you want to reset the variables, you just have to give them 0 for the numbers and “nothing” (empty) for the texts.

So if I call this sequence where I have reset all my variables I see that they are now quite empty.

It’s ideal to test the template as if you were using it for the first time and to check the path of your users.

We hope we have helped you, please do not hesitate to contact us for more information.

Plus:
– All about variables
The if condition feature

➜ Discover Botnation and launch your chatbot easily!