Clear UI when /restart is fired

I am using BotUI to render conversations with my rasa chatbot. I wanted to clear the screen if a user typed /restart on the screen.

From Reference - BotUI, I know that botui.message.removeAll will remove all the messages from UI.

On rasa server, I want a way to intervene when /restart intent is fired and clear the chat screen UI using the removeAll method of BotUI.

Can this be done?

Hello @tonysinghmss,

I’m not sure if this will work but can you try mapping a custom action (which removes all the messages on the screen) to the /restart intent using MappingPolicy ? You can read about it here: Policies

Hello @fuih

I handled it on the javascript side itself. I checked if the message coming from user, either through action or button, is /restart or not. If the message is /restart, I called the botui.message.removeAll.

Glad you figured it out :smile:.