Build Guide: Chatbot Pathways
Quick links in this article:
This article will outline exact steps for creating a ‘Chatbot Pathway’ flow, as part of an automation journey. Refer to Building A Chatbot: Flows for more information.
Before you build, it’s important to understand that each new message received in a chat will trigger the Response Received
event, and all of the flows contained within. Therefore, chatbot pathways must be built around understanding the individual message and the contextual data on the interaction to determine what to send next.
Check Current Pathway
In the steps below, we’re demonstrating how to build an example of a chatbot pathway - that might or might not be similar to your own! We’d recommend following the steps below and testing it anyway, to get a grasp on how it all fits together, before building to your plan.
Navigate to the builder and start by giving your flow a name (such as Pathway: X), then hitting File>Save. You’ll be able to keep saving your flow as you progress, to avoid losing progress.
Then, 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 the flow you’re building! If another path is active, it will go on to check any subsequent pathway flows instead. As with your previous chatbot flows, find your custom field in the Explore menu, under Interaction.Data
.
Check Step
On your Active Path branch (WISMO, in our example), 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
.
Check Step Decision
actions are a useful tool - try Saving the action to store it as a template in your action library to use in other flows.
Using + Add
, add a few more branches - we usually start by going up to 3! You can always come back and add more as required if your journey has lots of layers. Your flow should look like this so far:
Together, these two Decisions
help you to identify what part and stage of the chat journey the customer is at, so you know which response to send them next.
If you haven’t already, now’s a good time to File>Save your flow.
Branch: Step 0
Next, we’re going to build our response under Step 0. We already know the customer’s selection from the Check Pathway flow, where this pathway was assigned, but we haven’t yet responded to them!
The conversation so far might look like:
Chatbot: Hi, I’m Gnatta bot. I’m here to help. Please select an option: [Returns] [WISMO] [Other].
Customer: WISMO
Of course, behind the scenes you’ve checked it’s in an automated state and assigned a pathway, but the customer is waiting! So, let’s add a Send Autoresponse
action and get the conversation going. We’re going to respond with:
No problem. Please can you confirm your order number for us?
There are no quick reply buttons to attach to this one, so we can simply add the message to our action and click Submit.
Refer to your chatbot plan to identify which message you need to send!
Next, we’re going to update the Chatbot Journey Step
custom field to 1 - so that the next time the customer responds and this flow is triggered, the actions listed in the step 1 branch are activated instead. To do that, add an Update Interaction
action, and preset the Chatbot Journey Step
data field to 1.
Remember to rename your actions as you build, to make your flow easier to read - such as Set Step: 1
We’re also going to update the Stop
action to Stop Processing, whilst we listen for the customer’s response. This is to avoid triggering sequential flows whilst the customer is responding.
Branch: Step 1
The next time the customer responds, this branch will be activated. Hopefully, they’ve responded to our question with a number:
Chatbot: Hi, I’m Gnatta bot. I’m here to help. Please select an option: [Returns] [WISMO] [Other].
Customer: WISMO
Chatbot: No problem. Please can you confirm your order number for us?
Customer: I think it’s ORD-134623
In this demo scenario, order numbers are always formatted like this: ORD-123456
. So our first action is going to be Find Text
- we’re going to use RegEx to check if the format is correct before proceeding!
You can use ChatGPT or similar tools to generate simple Regexes! Check here for more information on using this action: Detecting & Extracting Data
We’re adding Echo.Body
(Message) as the source text to check against, and the extracted number is going to be stored in Regex.Output
- which we’re going to be able to use to preset a custom data field in a later action.
However - without Failure Branching, we’re not determining what to do if the customer responds with an order number that doesn’t match your order number format. So let’s toggle that on in our Find Text
action and split the flow.
On the No criteria met branch, the Regex has failed to identify a match. So let’s do the following:
Send an error message like
Oops, please check your order number has this format: ORD-123456
in a newSend Autoresponse
actionUpdate the step to journey step to 2 in an
Update Interaction
actionToggle the
Stop
action to stop processing
On the active branch of your Find Text
action, however, a match has been found! So let’s send a confirmation message like Thanks, we’ve noted that down for you.
using a Send Autoresponse
action.
Next, we can use an Update Interaction
action to store that Regex.Output in a custom data field. Click into Preset data, and identify your Order Number custom field. Then click Explore, and select the Regex.Output.
When this flow is activated, the Find Text
action will now attempt to match a number like ORD-123456 and if it finds one, it’ll be stored in that data field automatically.
At this point, if we had an integration setup with your tracking or order management system we could provide the tracking status directly via a Send Autoresponse
action! For our purposes here, however, we’re going to keep things simple and demonstrate a path end.
It’s time to assign to an agent - the chatbot journey has done it’s job and collected a reason for contact and a tracking number, and stored the details ready for the agent to pick up.
To do that, we’re going to add an Update Interaction
action, and change the Chatbot Pathway
custom field to Pass Agent
and the Chatbot Journey Step
to 0
.
It’s important to reset the Chatbot Journey Step
- so it can trigger the right stages in your Pass Agent flow!
Leave processing ON in the Stop
action, to ensure we move on to the Pass To Agent flow as soon as these actions are completed!
That’s it for this particular branch! When the flow is triggered, the message will go on to hit the Pass Agent flow provided it is listed after this one on the event.
Branch: Step 2
So far, the flow looks like this - notice however that we’ve ‘Set Step 2’ on Branch: Step 1 when the Regex failed to extract an order number, so in this branch for Step 2 we’re going to need to handle the customer’s response!
When you build your pathways, make sure every branching possibility reaches an ‘end’ - by passing to an agent or leading to the Anything Else flow.
Like in Step 1, you’re going to carry out the Find Text
action for the order number. Except this time, to avoid customer frustration, we’re not going to branch your flow if it fails and force them to try again.
We’re going to simply attempt the extraction, store the order number (it’ll store as a blank if nothing is detected), and then pass to an agent. Place each action again manually, or use the Copy and Paste functions. Just like this:
When you’re finished, it should look like this:
End Path: Anything Else
If the end of your path is to start again, not assign to an agent, simply set the Chatbot Pathway
custom field to Anything Else
, the Chatbot Journey Step
to 0
and leave processing ON.
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!
Pathway flows must be placed below the Check Pathway flow, and above the Anything Else/Assign Agent flows. Click and drag to reorder flows on an event.