What to do when the flow is in a loop? December 14, 2023 18:56 Updated Index: Demonstrative video Model of handling multiple incorrect responses Demonstrative video Model of handling multiple incorrect responses The video demonstrates a model for handling multiple incorrect responses for the same block in a flow. The goal is to show that it's possible to build a generic error handling system applied to more than one block within the flow, to address situations where errors might trap a client in an endless loop of repetition. To construct the solution, three blocks with questions that can be correct or incorrect were created. In a real situation, the 'no' option would correspond to a client's response that falls outside the defined pattern, directing them to the standard exit of the block. Upon exiting to Exceptions, three pieces of data will be collected into variables, and a sequence of actions will be executed: A counter will be created, if it doesn't exist already, to count the number of times the answer was incorrect. The name of the original block will be recorded in 'blockAnterior' if the counter is still zero (First error). 'idDoBloco' will be recorded to return the client to the block while repetition is allowed. The original block will be registered in 'blockOrigem' to always record the name of the last block, regardless of other conditions. A script will receive the collected information (excluding the block's ID) to count the number of consecutive repetitions where the client fell into the Exceptions block from the same place. The counter will reset if it surpasses 2 interactions to start a new count in case of new errors in future interactions with the same block after being overflowed. The exit condition of the block will return to the original block, using the 'idDoBloco' variable to reference the destination if the counter hasn't reached the predefined error limit. If the limit is reached, the standard exit will overflow the client. For more information, visit the discussion on the subject in our community or the videos on our channel. 😃 Related articles Exit Conditions in the Builder How to create a chatbot with Builder How to configure a destination block by variable How to create blocks in Builder How to configure Dialogflow as your AI provider