See how to create a loop in your bot. It can restart the bot from its very beginning or from a chosen action.
In this article, you'll learn:
Create a loop in your bot
If you have a bot (an FAQ bot, for example - for more information see our article on how to create one) which you'd like to run again every time an action is finished - you can create a loop that will restart the bot from the very beginning.
Right now, this feature is available in the bot editor directly. You don't even need to follow the manual instructions below to create a loop; you can do that straight from your bot's editing map.
To do that, choose an action - a point from which you'd like to create a loop. Then drag a connection line from that action to an earlier 'Decision' action. (It can be also a different action such as 'send a message' one but, it needs to have the 'decision' action on its workflow). That way, the user will be able to go back to an earlier step in the decision-making, and perhaps choose a different path.
That's all. You've now created your loop!
Here is a step-by-step guide on how to implement a loop into your existing bot:
Add the 'Visitor clicks the bots button' trigger
To add the 'Visitor clicks the bots button' trigger - go to the right side of your bot editor, and open the 'Triggers' section. Drag the 'Visitor clicks the bots button' node onto the map and connect it with the first action.
By adding the Visitor clicks the bots button trigger - you connect this bot with the Bots Launcher tool. This allows your website visitors to click on the bot and activate it again from the beginning.
Add the 'Chat with bot ended' action
Now, go to the Actions section on the right and drag the Chat with bot ended node onto your bot's map. Place it at the very end and connect all the final messages to that action.
The loop is now created! Every time your customer arrives at the end of the bot - it will restart and allow the visitor to see all the possible actions again.
Edit the last message sent by the bot
If you'd like to edit the message sent when the bot is finished, you can change it in the main 'Chatbots' section. Scroll down to the 'Bot chat ended message' section, found under the 'Bots Launcher' list at the bottom.
All done, now your looped bot is ready to use!