# Utter while processing custom action

**URL:** <https://forum.rasa.com/t/utter-while-processing-custom-action/12261>\
**Category:** Rasa Open Source\
**Created:** [June 30, 2019, 3:29am UTC](https://forum.rasa.com/t/utter-while-processing-custom-action/12261 "2019-06-30T03:29:38Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![wassgha](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/wassgha/32/3722_2.png) [@wassgha](https://forum.rasa.com/u/wassgha)\
**Post date:** [June 30, 2019, 3:29am UTC](https://forum.rasa.com/t/utter-while-processing-custom-action/12261/1 "2019-06-30T03:29:39Z")

</div>

Hey everyone!

I was wondering if it’s possible to utter something while a request is processing. For example, if the user asks a question that goes to a custom action, is it possible to utter “Give me a second to search that for you…”, perform the HTTP request and when the results are obtained, utter the result (all within the same custom action?).

I tried to use `dispatcher.utter_message` twice but it only prints after everything is done.

Thank you!

---

<div class="post-metadata">

**Author:** ![srikar\_1996](https://avatars.discourse-cdn.com/v4/letter/s/e274bd/32.png) [@srikar\_1996](https://forum.rasa.com/u/srikar_1996)\
**Post date:** [June 30, 2019, 6:10am UTC](https://forum.rasa.com/t/utter-while-processing-custom-action/12261/2 "2019-06-30T06:10:50Z")

</div>

Hi,

You can do this in the stories. Something like this:

```auto
* Intent
  - utter_wait
  - action_Your_customAction

```

Define **utter\_wait** in your templates in domail.yml as **Give me a second to search that for you…**. When the intent is identified, it will **utter\_wait** and then trigger your custom action.

---

<div class="post-metadata">

**Author:** ![wassgha](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/wassgha/32/3722_2.png) [@wassgha](https://forum.rasa.com/u/wassgha)\
**Post date:** [June 30, 2019, 6:14am UTC](https://forum.rasa.com/t/utter-while-processing-custom-action/12261/3 "2019-06-30T06:14:18Z")

</div>

Thank you a lot for the suggestion! Although that solves part of the problem, it doesn’t really solve sending multiple wait messages before the final result is delivered, however I’ll accept the answer if no other alternative exists.

---

<div class="post-metadata">

**Author:** ![wassgha](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/wassgha/32/3722_2.png) [@wassgha](https://forum.rasa.com/u/wassgha)\
**Post date:** [June 30, 2019, 6:49am UTC](https://forum.rasa.com/t/utter-while-processing-custom-action/12261/4 "2019-06-30T06:49:40Z")

</div>

Actually I’ve just tried this approach and it still only sends the messages after everything is done…

---

<div class="post-metadata">

**Author:** ![srikar\_1996](https://avatars.discourse-cdn.com/v4/letter/s/e274bd/32.png) [@srikar\_1996](https://forum.rasa.com/u/srikar_1996)\
**Post date:** [June 30, 2019, 8:07am UTC](https://forum.rasa.com/t/utter-while-processing-custom-action/12261/5 "2019-06-30T08:07:13Z")

</div>

Oh, it should send it before the action. Is it uttering once the action is executed?

---

<div class="post-metadata">

**Author:** ![JulianGerhard](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/juliangerhard/32/3781_2.png) [@JulianGerhard](https://forum.rasa.com/u/JulianGerhard)\
**Post date:** [June 30, 2019, 4:59pm UTC](https://forum.rasa.com/t/utter-while-processing-custom-action/12261/6 "2019-06-30T16:59:55Z")

</div>

Hi @wassgha,

is it necessary to wait for the HTTP request to return in the custom action? If not I would suggest to enter the custom action, utter via dispatcher, start the request either in a new thread or with asyncio and return the custom action.

Regards

---

<div class="post-metadata">

**Author:** ![wassgha](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/wassgha/32/3722_2.png) [@wassgha](https://forum.rasa.com/u/wassgha)\
**Post date:** [June 30, 2019, 5:54pm UTC](https://forum.rasa.com/t/utter-while-processing-custom-action/12261/7 "2019-06-30T17:54:22Z")

</div>

Hmm but how would you utter the result of the HTTP request afterwards?

@srikar_1996 it should but surprisingly it doesn’t, even though they are two separate actions

---

<div class="post-metadata">

**Author:** ![JulianGerhard](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/juliangerhard/32/3781_2.png) [@JulianGerhard](https://forum.rasa.com/u/JulianGerhard)\
**Post date:** [July 1, 2019, 5:15am UTC](https://forum.rasa.com/t/utter-while-processing-custom-action/12261/8 "2019-07-01T05:15:47Z")

</div>

Hi @wassgha

this is why I asked for the necessity to wait for the request. It could have been the case that it is a fire-and-forget process and then you could have done it my way. Unfortunately, Python handles things synchronously - so no, you can’t simply utter something this way.

Regards

---

<div class="post-metadata">

**Author:** ![vagi8](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/vagi8/32/12980_2.png) [@vagi8](https://forum.rasa.com/u/vagi8)\
**Post date:** [February 12, 2021, 6:50am UTC](https://forum.rasa.com/t/utter-while-processing-custom-action/12261/9 "2021-02-12T06:50:53Z")

</div>

Hi guys, @JulianGerhard

rasa 2.x has [CallbackInput](https://rasa.com/docs/rasa/connectors/your-own-website/). I have not tried it yet. but will the messages be uttered synchronously using this ?

---

<div class="post-metadata">

**Author:** ![vagi8](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/vagi8/32/12980_2.png) [@vagi8](https://forum.rasa.com/u/vagi8)\
**Post date:** [February 19, 2021, 11:56am UTC](https://forum.rasa.com/t/utter-while-processing-custom-action/12261/10 "2021-02-19T11:56:39Z")

</div>

@wassgha Hi. I have tested `CallbackInput` in rasa 2.X. and it sends dispatcher.utter\_message() synchronously
