Handle interruptions
When you build a flow that prompts the user for information you need to decide what should happen if the user doesn't respond to the question as expected. Users might also digress or change the subject.
Here you'll learn how to slightly adjust the coffee order flow so that it may be interrupted and then resumed with a dedicated prompt to the user to continue the flow where it was left off if the user asked another question instead of immediately responding to which coffee they want.
Let's look at an example:
User: I'd like to order a coffee.
Bot: Ok, what coffee would you like?User: Which coffees do you have? (the coffee order flow is interrupted)
Bot: We offer a variety of handcrafted coffee drinks - from espressos to macchiatos to flat whites and more.
Bot: Let's continue with your order. Which coffee would you like? (the coffee order flow is resumed)User: A flat white, please.
Bot: Ok, a flat white will be ready for pickup in 5 minutes.
In the conversation above there are two flows at play. First the coffee order flow, and then, in the middle of that flow, the flow about available coffee types. These flows are designed independently of each other, and there is nothing inside the flows that link them to each other. In fact, once we've adjusted the coffee order flow to survive interruptions, it may be interrupted by any other flow and still be resumed at the point it was interrupted.
To cater for the conversation above you only need to do two things:
- Check that the output node in the coffee order flow is prepared to survive interruptions (set it to revisitable).
- Add a resume prompt (optional).
Check that the output node is revisitable
To allow the output node to survive interruptions you need to make it revisitable. This is how you do that:
- Open the 'User wants to order a coffee' flow in edit mode.
- Select the output node 'Ask for coffee type'. This will open the 'output configuration' panel to the right.
- Located in the 'Resume Prompts' section is the option for 'Allow output to be revisited'. Per default, the option is activated and the limit is set to 2. The limit defines how many interruptions in a row the output node should survive. If you deactivate the option, you will note that a border around the node in the graph appears! This signals that the node is not revisitable.
Interrupt your bot in Tryout!
Now, go ahead and try the revisitability feature in Tryout! When the bot asks which coffee you want, test what happens if you say: 'Which coffees do you have?'.
User: I'd like to order a coffee.
Bot: Ok, what coffee would you like?
User: Which coffees do you have?
Add a resume prompt (Optional)
If you want your bot to say something slightly different when the output is resumed, you can add a resume prompt. This is how you do that:
- Select the output node 'Ask for coffee type'.
- Scroll down to the 'Resume prompts' section on the 'output configuration' panel.
- Click 'Add' and enter an answer text. For example,
Let's continue with your order. Which coffee would you like?
- Hit 'Save'.
Interrupt your bot again!
Have another play in Tryout. What happens now if you say 'Which coffees do you have' instead of replying to the prompt for type of coffee?
User: I'd like to order a coffee.
Bot: Ok, what coffee would you like?User: Which coffees do you have? (the coffee order flow is interrupted)
Bot: We offer a variety of handcrafted coffee drinks - from espressos to macchiatos to flat whites and more.
Bot: Let's continue with your order. Which coffee would you like? (the coffee order flow is resumed)User: A flat white, please.
Bot: Ok, a flat white will be ready for pickup in 5 minutes.