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:

  1. Create a new bot.
  2. Drag a question interaction onto the canvas.
  3. In When the User Says, enter the word or words to trigger the interaction. For example start.
  4. In Respond to User, enter your question. For example Which of these flavors do you prefer?
  5. 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:

  1. On the toolbar, click Bot Settings.
  2. Go to the Defaults tab.
  3. 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.
  4. Click OK.
  5. 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:

  1. Create the intention:
    1. In the Details tab, find Intent.
    2. In the dropdown under Intent, select Create new intent. Enter a name for the intent, for example, other flavors.
    3. In Add new utterance, enter an unwanted answer. For example, enter mint.
    4. Repeat this step for each unwanted answer.

      For example:

    5. When you have added all the unwanted answers, click Save to save the intention.
  2. Add a message interaction that uses the intention:
    1. Drag a message onto the canvas.
    2. In the Intent field, select your intention.
    3. 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.
    4. 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:

  3. Use Preview to test the bot.
In reality it is not good practice to create a bot that leaves a user stuck in a loop like this. It is preferable to advance the conversation by providing a way for the user to leave feedback. The Example: using counters and conditions shows how to count the number of times a user has seen a particular interaction and then show a different interaction depending on the result.