Flow Designs: Handle multiple user or customer messages
When you’re trying to capture a message from a user, you might encounter a scenario where they answer in more than 1 message. When your bot proceeds with the next step without letting the user finish their message, you might lose useful information. Therefore, we recommended that you set this up differently, especially for cases where you are gathering information to push it to a customer service tool.
In this guide, we look at three solutions to give the user the chance to finish their message before proceeding:
- Ask for 1 message
- Indicate when finished
- Wait for input
Ask for 1 message
This solution is very primitive and simple to implement. The downside is that this solution won’t be perceived as a natural conversation.
How it works: Within the Bot’s text reply, indicate to deliver only 1 message.
Indicate when finished
When you want to give your customers a bit more space, you can allow them to send several messages. This leads to more complex design. Even though the user should indicate when “Done”, it feels more natural than the first solution.
How it works: The parameters that you can fill are lists. Multiple messages by the user add messages to the list. When the user types “Done”, the bot knows that the list is complete and can continue.
You can use the following code to check if the user types "Done" and redirect to the right event. Make sure to adjust the names of your parameters and events.
async payload => {
if(Array.isArray(payload.params.message)) {
message = payload.params.message[payload.params.message.length - 1].value
//console.log(message)
if(message == "Done"||message == "done"){
trigger('Done');
} else{
trigger('Question')
}
}
}
Wait for input
The third and most natural solution gives your users time to create several messages. The design is more complex than the first solution and is also more error prone than the previous two, especially when there is a large difference between the type of users. One person can type much faster than the another person.
How it works: Similar to the previous step we add several messages to a list. Whenever the bot does not receive a new messages within 5 seconds (or more depending on your case), we can assume that it’s safe to proceed to the next step.
Updated about 1 year ago