Sending multiple messages a few seconds apart

Rasa version: 1.10.3 Rasa-SDK: 1.10.1 Python 3.7.7

Hello! I am relatively new to Rasa Open source and am trying to integrate a chatbot into Slack. Currently, I have a custom action that takes ~10 seconds to run and return information to the user due to having to call a lot of APIs. As such, I am hoping to first send an instant message back to the user like “This will take a few seconds” and then proceed to execute the action and then send the second message.

I tried a variety of methods to achieve this but every method results in both messages being sent at the same time. These methods include sending dispatcher messages on different threads and using the slackclient web_client.

Any guidance would be much appreciated!

1 Like

Hello @jkuan

What do you use to call the API ?

  1. Do you use Custom Action to call the API ?
  2. Do you use Form Action to call the API ?
  3. If you are using Form Action, where do you call the API ? In the validate function or submit function ?

Thank you for the follow-up @fuih and apologies for not making this clear earlier. I use a custom action to call the API. The custom action also works as expected when deployed locally or remotely as a docker container. It’s just that the inability to send instant feedback to confirm the message was received does downgrade the user experience.

I see, in that case, can you create an utter such as utter_waiting in your domain.yml, and then put it before your custom action which call the API in your ?

* User intent
- utter_waiting
- call_api_action

So when the user invokes the intent, the bot will utter the waiting message “This is gonna take a few minutes” before calling the API.


Haha I should have thought about that sooner. Just tried it out and it works like a charm. Thanks for the tip!

However, as I move forward in the future, is it possible in any way to be able to do this proactively in my custom actions? For example, if an action runs for longer then 2 seconds (according to an internal timer), it can send the utter_wait message out and then continue with the action. I have yet to attempt this but am curious if you have any thoughts on the matter.

I believe this is not possible for now, at least at Rasa side. It seems like all the utters dispatched from a custom actions will only be sent after the action return.

If you have your own UI or website, then you might be able to implement this on the front end. Something like a timer for Rasa bot’s responses and if it took too long then you actively display the waiting message.

I see, thank you very much for helping!

Rasa version: 2.4, Python 3.7.6

Hi, I am trying to achieve the same, I want to show an utterance like “Please wait…” before calling an action which takes a long time. For that, I made below changes to the example concertbot provided in the rasa examples directory (rasa/examples/concertbot at main · RasaHQ/rasa · GitHub) -

  • Added “utter_wait” as a response in domain.yml
  • Added “utter_wait” before the action call in stories.yml
  • Added time.sleep() in the action method

Unfortunately, the utter_wait response comes at the same time with the action response, not before the action response. What am I doing wrong?

I have attached my stories.yml and domain.yml file (sorry I am facing some issues with the backquote formatter)

stories.yml (1.5 KB) domain.yml (1.2 KB)


@muntasir2000 You are right, rasa aggregates utterances from successive actions including custom actions and utterances and sends them at one shot. So fuih’s solution is not working at rasa 2.8.7 . if you have found a solution, please let me know. thanks