Example: handling unwanted and unexpected answers
This example bot demonstrates how you can provide responses for answers from the user that are either unexpected or unwanted. This figure shows a default response for unexpected answers (That wasn't really what I was expecting), and a more tailored response for an unwanted answer:
Step 1: Create a question with expected answers
Create a question with the main answers to the question.
Result of step 1
To create a question with the expected answers:
- Create a new bot.
- Drag a question interaction to the canvas.
- In When the User Says, enter the word or words to trigger the interaction. For example start.
- In Respond to User, enter your question. For example Which of these flavors do you prefer?
- On the Answers tab, under Set Answer Type, select Set up Button/Quick Reply Answer. Then click +Answer to add each expected answer to the question, followed by OK. For example, enter Strawberry, Chocolate, Lemon, None of these.
Step 2: Handle unexpected answers
You can configure a default message. This is sent to the user whenever the bot receives an answer that has no match to any of the answers defined for the interaction and not in any intention (we'll create the intention later).
Result of step 2
To set up a default answer:
- On the toolbar, click Bot Settings.
- Go to the Defaults tab.
- In Default Question/Answer Reply, enter the text that you want to send to the user whenever their answer to a question is unexpected. This answer will be used by all the interactions in this bot.
- Click OK.
- You can use Preview to test the default answer.
Step 3: Handle unwanted answers
This step shows how you can handle answers that need a response but which are not a direct reply to your question.Result of step 3
This solution makes use of intentions:
- Create the intention:
- In the Details tab, find Intent.
- In the dropdown under Intent, select Create new intent. Enter a name for the intent, for example, other flavors.
- In Add new utterance, enter an unwanted answer. For example, enter mint.
- Repeat this step for each unwanted answer.
For example:
- When you have added all the unwanted answers, click Save to save the intention.
- Add a message interaction that uses the intention:
- Drag a message to the canvas.
- In the Intent field, select your intention.
- In Respond to User, enter the text that you want to send whenever the bot receives an answer that does not match the question but matches the intention. You could also randomize the message that is sent (use the Advanced tab to add these). For example, That's interesting but it's not part of our current range.
- Link the message to your question interaction. This means that after displaying the message, the bot will show the question again. The bot should look similar to this:
- Use Preview to test the bot.