How can I set a fixed response for any intent after a conversation was finished in a time?

Version: Rasa X 0.33.2 Hi everyone,

As my Topic, please help me to solve this problem. Many thanks

It would be helpful if you explain your use-case a bit more. What do you mean by a conversation finished in a time? Is there a time-constraint for the conversation?

Thanks for replying. In my case, I’d like to collect user’s information via a form. If the form is completely filled, the conversation will finish. Next step, I want to respond a fixed answer during a specific time (for example: during 60 minutes after finishing the conversation) if the user gives any question for my bot in the time. And after the time, my bot will normally response for the user.

Thanks for elaborating, it’s much more clear now.

I think you may want to look into reminders (check the link here: Events)

The way I would do it is to set date_time to 60 minutes after the form submission is executed. You could set it to trigger an intent that maps to a certain response you’d like your bot to say 60 minutes later. In case the user responds during those 60 minutes (or something like that, since I don’t know your exact use-case), then you can cancel this reminder using cancel_reminder (right below reminder Events). On the same page, you can also find events that allow you to pause or resume a session, and you could have a count-down timer inside your action server to resume the session after a certain amount of time.

I think it’s not a reminder. Let me try to explain my case clearer. As I described above, after the form is completely filled, it does NOT remind anything to the user after 60 minutes but during the whole next 60 minutes, with any intents from the user, my bot will response the same answer. After this time, my bot should work normally.

So just to understand you correctly, after this form is completed and has been submitted, you want your bot to reply with the same message every single time to the user no matter what the user’s intent is?

And then, after 60 minutes have passed, you want the bot to go back to responding normally, correct?

Yes, that is what I want to do

Do you have any ideas for this problem?

I have a couple of thoughts. But it would still involve using Reminders. I also think this may be a thing to handle using rules since you always want your bot to behave this way.

Idea 1 (this one is insane)

  1. Create a slot and entity (let’s call it activated). This will act as a flag we can use as a condition. Make sure it affects the conversation. It could be set to false by default.
  2. When a form is submitted, set it to true and activate a reminder. The reminder is not really going to be used to remind the user of anything, but we’d be using it here as a timer. The date_time of the reminder should be 60 minutes after it’s activated, So, if the form was submitted at 2020-09-03T11:41:10.128172, the reminder should go off at 2020-09-03T12:41:10.128172. This way, you are able to activate some event after 60 minutes, and this is precisely what this reminder will do: it will set activated back to false after 60 minutes.
  3. Create a rule with a condition (read more about that in the docs: Rules). The thing I haven’t figured out yet exactly (probably needing to test a thing or two first) is how you would tell the rule to ignore intents. One clumsy way of doing that is using or: followed by a list of every single intent you have so that your rule might look something like this:
  • rule: Reply with the same thing if activated condition:

    • slot_was_set:
      • activated: true


    • or:
      • intent: greet
      • intent: do-something
      • intent: do-some-other-thing
      • intent: goodbye
    • action: utter_fixed_response

Idea 2 (problematic)

Don’t actually submit the form. Have an extra slot, let’s give it the same name: activated. When the user is done filling the last slot you actually need, the form will try to fill the last one. Use a custom action action_ask_activated to always return the same response no matter what the user asks to fill it with until 60 minutes have passed. This is problematic because the user may also trigger other intents like saying goodbye, which Rasa will classify as the intent /goodbye, which could trigger another action based on your rules and stories.

Idea 3

Make this a front-end solution. After the form is submitted, trigger a front-end action that displays the same message to the user no matter what they type in for 60 minutes (maybe with the help of the validation step). After that, it can start sending messages again to Rasa. Make sure you set the timeout for 1-2 hours because your conversation contains 60 minutes of no calls made to Rasa.

You could probably record the start and end time in a slot, then return the same utterance in validation as long as 60 minutes have not yet passed.

I’m sure other people have more elegant ideas, and it would help if you talk more about your use case. Why do you need the same response for 60 minutes straight?

Thank you very much. I’ll think more about your ideas

1 Like