How can I add 2 intents for a button?

Hi. I have a chatbot which displays a button called “start a new conversation” at the end of every conversation. When a user clicks this button, I want to

  1. reset the conversation. [intent for default action -> action_restart, which resets all the slots]
  2. followed by intent_greet. So, I want these 2 things to happen when the user clicks this button. Basically adding 2 payloads for a button. Please let me know if anyone has got some ideas. Thankyou.

Hi @Akhil,

Have you tried this approach of writing

return [AllSlotsReset()] from rasa_sdk.events import AllSlotsReset in actions.py and call the custom action whenever you want to reset the slot.

1 Like

Hi @MuraliChandran14,

Thanks for replying.

What I meant was, the whole conversation should be restarted on clicking the button. With your idea, I was able to use

return [Restarted()] from rasa_sdk.events import Restarted in actions.py

The slots are getting reset but, the next actions are not being performed.

This is my story:

image

The responses listed after action_restart_conversation are not working.

Ther terminal output:

I think, it is forgetting that it should perform some more actions after performing reset. Any suggestions?

Hi @Akhil

If you are using Restarted(). Then you can declare the templates inside the actions.py itself.

. When Restarted() is called I assume the slots and conversations are restarted and there is no point for the remaining conversations to continue.

If you do a

First you are resetting the slots in your actions.py and then resume the remaining conversation in your stories.md and finally calling action_restart will reset the conversation.

1 Like

Hi, @MuraliChandran14. Thank you very much for your suggestion. My bot is designed such that, on start of a new conversation it gives a welcome response. So when I click the start a new conversation button, it should

  1. Delete all chat history in the UI window.
  2. Reset all slots.
  3. Invoke greet response.

So, I have to use create a custom action and use

return [Restarted()] from rasa_sdk.events import Restarted

But, like we are guessing, once Restarted() is invoked, the story stops as the bot is forgetting the story and next actions.

As u suggested, I overcame this by writing those greet responses before calling Restarted().

2nd and simple way:

I found that I need not write a custom action for this. I can use default action - action_restart in my story. I can simply write my story like this.

image

Once again, thank you very much!! for your time.

1 Like