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 Ask
and 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.
Saving intents & variables to Memory
Unlike Ask
block, Say with fallbacks
blocks 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 fallbacks
is 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.
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 ofReset fallback
block to set memory.fallback to 0. Thanks to that, you can deleteReset fallback
block.
Updated 10 months ago