search

How to Create a Loop in Your Bot

In this article, we will show you how to create a loop in your bot. It can restart the bot from its very beginning or from a chosen action.


How to 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.

NOTE: you can also connect your chosen action to a different action such as ‘Send a chat message’ action, but a ‘Decision’ action needs to be on the way of that bot’s flow in order for the loop to work.

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


Workaround instructions

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

Add the ‘Chat with bot ended’ action

Edit the last message sent by the 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 specific 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. Click the ‘Bot chat ended message’ found under the ‘Bots Launcher’ list at the bottom.

Where to edit the message sent by the bot at the end
Where to edit the message sent when the bot is finished

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

If you have any other issues with the chatbots, please reach out to us. You can contact us via [email protected] or use the chat in the bottom-right corner of our website.

Can't find what you're looking for?

CONTACT SUPPORT