How to specify a user timeout

I am new to Rasa, just getting started. I want to specify a timeout in stories.md or domain.yml whereby if the user does not respond to bot’s message for say 30 seconds or if the user is silent for say 30 seconds then the bot times out and executes the default fall back action. Can you please tell me how this can be done?

I think you can do this easily. There is a trick for this.

I assume you have one frontend App - either Web App or Mobile App where you can consuming Rasa REST API.

  1. After getting response from Rasa backend, start a counter in your App
  2. When it reaches 30 seconds, in the background call rasa Rest API with message body as “/restart”
  3. It’s inbuilt in rasa when you send “/restart” is message body it will reset conversation for that user/id.

Body Sample { “sender”: “user”, “message”: “/restart” }

  1. Then show a message to user saying something like “Session ended or thank you” - You need to handle or write this in your frontend code
2 Likes

i know this is an old chat but is there a plan to implement functionality so that when the session configuration ends, the Core model can kick off an end_session action?

Then we can overwrite that custom action and have that send a messages that let’s the user know the session ended.

In our use case, the channel where the user interacts with the bot keeps the history of previous interactions with the bot. Thus the session ends but the user may try to continue the conversation they were previously having.

The solution that @bikashkumars presents is a nice hack but it would be cleaner if we can incorporate this functionality with the config file. That way if we have multiple channels we don’t have to embed this code in each channel.

I guess the concern is how the config file is actually implemented. If the Core model determines it should restart by querying the last date/time during a user event and seeing if that time is less than the timeout, then it wouldn’t be able to implemented…