Can we customized the default /restart

In my scenario bot give the user option to restart the conversation using the restart button and when the user clicks the restart button it will call the payload. Is there any way i can send a message “Hi how can i help you”? after the click of restart button?

    - text: "Click the button below if you want to start over."
      - title: "Restart"
        payload: "/restart"
1 Like

Yes, you can create this functionality by introducing another restart intent that triggers a custom action. I did it like this:

  1. Create another intent called restart_conversation or whatever

  2. Create a custom action called action_reset or something like this. This action will reset the conversation state, send a get_started intent to the DST and queue an utter_greet follow-up action. The get_started is really only necessary as I use rasa-webchat, in order to let the bot initiate the conversation upon opening the widget. You can customize this to your needs. So in your case, “Hi, how can I help you?” would be the utter_greet intent. My custom action looks like this:

     class ActionReset(Action):
         def name(self):
             return "action_reset"
     def run(self, dispatcher, tracker, domain):
         return [Restarted(), UserUttered(text="/get_started", parse_data={
                          "intent": {"confidence": 1.0, "name": "get_started"}, 
                          "entities": []
                         }), FollowupAction(name="utter_greet")]
  3. Map restart_conversation to trigger the custom action via mapping policy.

1 Like