Create a Loop in Your Bot
  • 2 Minutes to read
  • Comment
  • Dark
    Light

Create a Loop in Your Bot

  • Comment
  • Dark
    Light

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.


creating a loop in your bot editor
You can create a loop directly in the bot editor - drag a connection line back to an action you'd like to return to

 

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.


💡
You can also connect your chosen action to a different action, such as the 'Send a chat message' action, but a 'Decision' action needs to be on the way of that bot's flow for the loop to work.


That's all, you've now created your loop!


Alternative instruction


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.


How to add the 'visitor clicks the bots button' trigger

 

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.


'Chat with bot ended' added to the map
Where to add the 'Chat with bot ended' 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.


FAQ bot starts again - loop is created
How the loop will look like 

 

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.


Where to edit the message sent when the bot is finished

 

All done, now your looped bot is ready to use!



If you still have some questions for our team after reading this article, don't hesitate to contact us.


Was this article helpful?