BotMan Quick Tip - How to repeat a question
Most chatbots today are like forms. You provide some information and then you’ll get something in return. So for example you answer some questions and the bot will show you a product that fits your needs. This means it is important that it understands your responses. If not, the bot needs to ask you again and
repeat the question. That’s not what we want but it will happen and this why I am very glad BotMan implemented a
Repeat a question
repeat() method is something you can use inside a Conversation. So let’s look at an easy example.
In my last article I explained how to use a default pattern in BotMan. This is our base for today. We have a simple question and three different patterns. If the answer is
positive we can go on and ask the next question. When it is negative we may ask something differently. If the first two patterns are not matched, the last
default one will be triggered. We didn’t understand the user’s response and the best way to solve that problem is by asking the user again.
BotMan will now sent the question again when we do not get our needed answer. That’s quite good so far but you will notice that the second question often doesn’t feel that nice. Repeating the exact same question again is something we know from machines but not from humans. So this
does not feel natural and it is better to change the second one. Luckily BotMan helps us here again and you can pass an aurgumnt to the
The same conversation question will be triggered again but with the new text now. This is so much better now right? Right :-) And as if this is not enough you could even use a
Question object instead of the string.
So that was it for today. Repeating is a simple but really powerful BotMan feature that you should use a lot. So start today!