Build Guide: Anything Else Loops
Quick links in this article:
This article will outline exact steps for creating an ‘Anything Else Loop’, as part of an automation journey. Refer to Building A Chatbot: Flows for more information.
Check Current Pathway
Navigate to the builder and start by giving your flow a name, then hitting File>Save. You’ll be able to keep saving your flow as you progress, to avoid losing progress.
Much like the Pathway: X flows, you’ll need to start out by adding a Decision
as your first action. This is going to check if the current value for Chatbot Pathway
custom field matches Anything Else
. If another path is active, it will go on to check any subsequent pathway flows instead.
Check Step
On your Active Path branch (Anything Else, in this case) you’ll be adding a Check Step Decision
action. This will split your flow based on the current value of your Chatbot Journey Step
custom field. To do that, set the condition for the first branch as Chatbot Journey Step
equals 0
. As previously, you’ll need to find that custom field in Interaction.Data
.
Then go ahead and click + Add to get another branch for Step 1. That’s all you’ll need for this flow!
Alternatively, if you Saved your Check Step Decision
action in a previous flow you could insert it here, to save some time.
Branch 0
On Branch 0 of an Anything Else loop, we’re assuming the conversation has reached a natural end. For example, this might be the chat so far:
Chatbot: How can I help today? [Returns] [Tracking] [Website issue]
Customer: Tracking
Chatbot: No problem, please can you confirm your order number?
Customer: ORD-123456
Chatbot: Got it! I’ve located that order for you. Looks like that’s out for delivery today, by 2pm.
Instead of simply closing the chat immediately, we’d like to immediately follow-up with a question like:
Chatbot: Is there anything else I can help you with today? [Yes] [No]
To do that, we’re going to:
Add a
Send Autoresponse
action to the branch, with quick reply buttons for Yes and NoUse an
Update Interaction
action to set theChatbot Journey Step
to 1Stop Processing in the
Stop
action
With that done, your flow so far should look like this:
Branch 1
In this branch, we first need to identify the customer’s selection from Branch 0 - either Yes or No! The quickest way to do that is to reopen the corresponding Send Autoresponse
action and click the ‘Copy to decision’ button. This will auto-generate a Decision
into your action library, ready to insert on Branch 1.
Branch 1: Yes
If the customer has selected ‘Yes’, then we’ll need to do a few things:
Use
Send Autoresponse
to present exactly the same Welcome Options you sent in your Chatbot Starter Flow i.e.No problem! Please select an option: [Returns] [Tracking] [Website issue]
Update the
Chatbot Pathway
to Reset andChatbot Journey Step
to 0Stop processing in the
Stop
action
Branch 1: No
If the customer has selected ‘No’, then we’re going to do the following:
Send a closing messaging like
No problem, thanks for chatting today. The conversation will be closed shortly.
using theSend Autoresponse
action, with a 5 second delay to avoid closing the chat before the message is read!Use
Close Conversation
to close the chat - if a post-chat survey is configured on the account, this will be presented automatically.The chat might be closed, but the interaction is still on your queue! Use
Update Interaction
to change theStatus
custom field to Closed andChatbot Journey Step
to Complete.
Error Handling
So far, your flow should look like this:
We’ve not handled here what to do if the customer should type their response, instead of selecting Yes or No from the buttons. For example ‘I don’t need anything thanks' wouldn’t trigger either of those closing branches. So, let’s send an error message like this:
Oops, I'm just a chatbot! Please select a button to continue: [Yes] [No]
Then, as we don’t want to change the journey step, we can simply set the Stop
action to stop processing.
Save and Publish
Hit File>Save and File>Publish, then attach your new flow to your Response Received
event then head to your test environment to see how it looks on the front end!
Ensure this flow is placed below your Pathway: X flows, so that it always runs after them.