Fallbacks

Fallback responses are used when a bot has to repeat the same question - for example when the user provided wrong answer or was silent

👍

See this example project you can import into your environment.

Fallback responses are used when a bot has to repeat the same question - for example when the user provided wrong answer or was silent. To make those repetitions more user-friendly and human-like, conversational UI requires that they are not identical to the first asked question.

For example:

Bad 😒Good 😊
Bot: “Please say your PIN code.”Bot: “Please say your PIN code.”
Human: “123”Human: “123”
Bot: “Please say your PIN code.”Bot: “Your PIN code should have 4 digits. Please try again.”
Human: “1234”Human: “1234”
Bot: “Please say your PIN code.”Bot: “The PIN code you provided is not correct. Please try again.”

No customizable fallbacks: Say and Ask blocks

By default, if we use Request User Input in blocks such as Say or Askand there is no output that fulfils given conditions, the bot will repeat his response in an identical way. This is why this is generally considered a bad practice to use these blocks together withRequest User Input outside of the most basic demo bots. The only exception is when the responses (and fallback responses) are generated from Knowledge Base.

So, to customize fallback responses, we can use one of the following methods:

Basic method: Say with fallbacks block

This method uses a dedicated Say with fallbacks block to handle fallback responses. When the conditions given in any of the outputs are not fulfilled and the bot can’t continue with the conversation, the bot will repeat the question using fallbacks responses provided in the block setup.

🟩 When to use: for simple conditions that can be resolved using only Say with fallbacks block outputs.

🟥 When not to use: for complex or multiple conditions that are resolved in the blocks coming after Say with fallbacks block.

Fallback responses 👉 1. Basic method

Fallback responses 👉 1. Basic method

Say with fallbacks setup 📷

Say with fallbacks setup 📷

Say with fallbacks outputs 📷

Say with fallbacks outputs 📷

Saving intents & variables to Memory

Unlike Ask block, Say with fallbacksblocks doesn’t automatically saves anything to Memory, so we have to do it in the next Custom block using Memory input fields.

📘

Learn more about Say with fallbacks block here

Fully customizable method: Say conditional block

There are situations where Say with fallbacksis not enough because the block in which you request user input is not the same where you are able to resolve a condition.

For example, when you ask for a birthdate during authorization process, you will know if you need a fallback only after you use Integration block to verify a user via API.

Another example is when you want to use Custom block to use more complex Expression language or JavaScript to check a user input for condition.

Fallback_responses 👉 2. Fully customizable method

Fallback_responses 👉 2. Fully customizable method

Adding multiple fallbacks to the same question

To add multiple fallbacks, you need to create a small loop using Custom blocks, like on the screen above. This example checks if the date provided by the user is a Saturday. It uses Say conditional dependant on a loop to add mutliple fallback replies.

💡

Alternative

Use Save date to Memory block instead of Reset fallback block to set memory.fallback to 0. Thanks to that, you can delete Reset fallback block.