How to send different responses if default_fallback occurs many times in a row?

Hello Rasa Community!

I want to make my chatbot understand when default_fallback occurs and respond differently if it occurs many times in a row.

For example the first fallback response should be “Sorry, couldn’t understand. Can you rephrase?”. If a fallback occurs again (right after the first one) it should respond with “Still didn’t get it. Wanna try again?”. If another fallback occurs (right after the second one) I want the bot to say something like “You can contact the support team to solve your problem”.

Any idea on how to achieve this? Default fallback is defined as a custom action in my code like this:

class ActionDefaultFallback(Action):

    def name(self) -> Text:
        return "action_default_fallback"

    def run(self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:


        return []

your custom action could set unfeaturized counter slot that would count number of times custom action occurred then check last executed actions before listen and if it is not fallback reset the counter

1 Like

Thanks @Ghostvv, this worked for me :slightly_smiling_face: