# Break long answers into small sentences in rasa

**URL:** <https://forum.rasa.com/t/break-long-answers-into-small-sentences-in-rasa/14829>\
**Category:** Rasa Open Source\
**Created:** [August 26, 2019, 5:34pm UTC](https://forum.rasa.com/t/break-long-answers-into-small-sentences-in-rasa/14829 "2019-08-26T17:34:28Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![piyush29programmer](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/piyush29programmer/32/4050_2.png) [@piyush29programmer](https://forum.rasa.com/u/piyush29programmer)\
**Post date:** [August 26, 2019, 5:34pm UTC](https://forum.rasa.com/t/break-long-answers-into-small-sentences-in-rasa/14829/1 "2019-08-26T17:34:28Z")

</div>

When Rasa answers a question, those answers may contain several lengthy sentences. This can be difficult to read. It would be nice, if we could break these paragraphs up and send the individual sentences to the user, in a delayed manner.

Is there any possible way to that?

---

<div class="post-metadata">

**Author:** ![tmbo](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/tmbo/32/19_2.png) [@tmbo](https://forum.rasa.com/u/tmbo)\
**Post date:** [August 27, 2019, 6:24am UTC](https://forum.rasa.com/t/break-long-answers-into-small-sentences-in-rasa/14829/2 "2019-08-27T06:24:36Z")

</div>

From within a custom action, you can call `dispatcher.utter_template` (or `utter_message`) multiple times and the user will get multiple messages even though only a single action got executed.

Not sure if we removed this, but I think you can also create multiple messages by using a double newline: `"Hey how are you?\n\n I am here to help!"`.

---

<div class="post-metadata">

**Author:** ![piyush29programmer](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/piyush29programmer/32/4050_2.png) [@piyush29programmer](https://forum.rasa.com/u/piyush29programmer)\
**Post date:** [September 2, 2019, 5:30pm UTC](https://forum.rasa.com/t/break-long-answers-into-small-sentences-in-rasa/14829/3 "2019-09-02T17:30:46Z")

</div>

Hi tmbo , i agree on first point that we can send multiple response using utter\_message multiple times but your point of add “\n\n” is not working.

\n\n is adding a new line when send response back to bot but its not splitting the string in actions . Does rasa have any inbuild function which does this functionality.(other approach is also fine)

---

<div class="post-metadata">

**Author:** ![tmbo](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/tmbo/32/19_2.png) [@tmbo](https://forum.rasa.com/u/tmbo)\
**Post date:** [September 2, 2019, 6:11pm UTC](https://forum.rasa.com/t/break-long-answers-into-small-sentences-in-rasa/14829/4 "2019-09-02T18:11:26Z")

</div>

Which input / output channel are you using?

---

<div class="post-metadata">

**Author:** ![piyush29programmer](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/piyush29programmer/32/4050_2.png) [@piyush29programmer](https://forum.rasa.com/u/piyush29programmer)\
**Post date:** [September 2, 2019, 6:23pm UTC](https://forum.rasa.com/t/break-long-answers-into-small-sentences-in-rasa/14829/5 "2019-09-02T18:23:02Z")

</div>

I am using socketio channel .

---

<div class="post-metadata">

**Author:** ![tmbo](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/tmbo/32/19_2.png) [@tmbo](https://forum.rasa.com/u/tmbo)\
**Post date:** [September 2, 2019, 9:35pm UTC](https://forum.rasa.com/t/break-long-answers-into-small-sentences-in-rasa/14829/6 "2019-09-02T21:35:23Z")

</div>

ah great - the socketio connector is the only connector which doesn’t have this implemented. Would be great if you can open a feature request on github. If you have a second and want to contribute to the project: this would be a great contribution 😉

---

<div class="post-metadata">

**Author:** ![shaileshsarda](https://avatars.discourse-cdn.com/v4/letter/s/9f8e36/32.png) [@shaileshsarda](https://forum.rasa.com/u/shaileshsarda)\
**Post date:** [February 27, 2020, 7:12am UTC](https://forum.rasa.com/t/break-long-answers-into-small-sentences-in-rasa/14829/7 "2020-02-27T07:12:41Z")

</div>

@tmbo Yeah socketio is not support for the new line character specification (\n) into the domain.yml. Could you please provide any alternative for that?

---

<div class="post-metadata">

**Author:** ![tmbo](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/tmbo/32/19_2.png) [@tmbo](https://forum.rasa.com/u/tmbo)\
**Post date:** [February 27, 2020, 8:06am UTC](https://forum.rasa.com/t/break-long-answers-into-small-sentences-in-rasa/14829/8 "2020-02-27T08:06:22Z")

</div>

the socket io channel will be fixed and properly splits messages at `\n\n` after the next release

---

<div class="post-metadata">

**Author:** ![shaileshsarda](https://avatars.discourse-cdn.com/v4/letter/s/9f8e36/32.png) [@shaileshsarda](https://forum.rasa.com/u/shaileshsarda)\
**Post date:** [February 27, 2020, 10:52am UTC](https://forum.rasa.com/t/break-long-answers-into-small-sentences-in-rasa/14829/9 "2020-02-27T10:52:54Z")

</div>

@tmbo \n\n splits the bot answers throughout separately. I want the line splitting in only one message from the bot.

---

<div class="post-metadata">

**Author:** ![vreddy27193](https://avatars.discourse-cdn.com/v4/letter/v/49beb7/32.png) [@vreddy27193](https://forum.rasa.com/u/vreddy27193)\
**Post date:** [June 18, 2020, 8:24am UTC](https://forum.rasa.com/t/break-long-answers-into-small-sentences-in-rasa/14829/10 "2020-06-18T08:24:47Z")

</div>

Hi for bullets use “\n\* line1. \n\* line2” you will get output as:

- line1
- line2

---

<div class="post-metadata">

**Author:** ![IDKYamHere](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/idkyamhere/32/8720_2.png) [@IDKYamHere](https://forum.rasa.com/u/IDKYamHere)\
**Post date:** [June 28, 2020, 9:31pm UTC](https://forum.rasa.com/t/break-long-answers-into-small-sentences-in-rasa/14829/11 "2020-06-28T21:31:58Z")

</div>

Using \ \n (\double space\n) worked for me.

Example:

`utter_message: "Hi! \ \n This is Sid"`

Gives the output [in the same message] : -

Hi!

This is Sid

---

<div class="post-metadata">

**Author:** ![zack](https://avatars.discourse-cdn.com/v4/letter/z/f6c823/32.png) [@zack](https://forum.rasa.com/u/zack)\
**Post date:** [May 3, 2021, 2:55pm UTC](https://forum.rasa.com/t/break-long-answers-into-small-sentences-in-rasa/14829/12 "2021-05-03T14:55:16Z")

</div>

Hi @tmbo ,

how about adding a time delay between each of the splitted response ?

---

<div class="post-metadata">

**Author:** ![asc](https://avatars.discourse-cdn.com/v4/letter/a/94ad74/32.png) [@asc](https://forum.rasa.com/u/asc)\
**Post date:** [June 22, 2021, 3:01pm UTC](https://forum.rasa.com/t/break-long-answers-into-small-sentences-in-rasa/14829/13 "2021-06-22T15:01:44Z")

</div>

Hello, I’d like to add a time delay between messages. Any ideas on how this can be achieved?

---

<div class="post-metadata">

**Author:** ![nik202](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nik202/32/16098_2.png) [@nik202](https://forum.rasa.com/u/nik202)\
**Post date:** [June 22, 2021, 5:31pm UTC](https://forum.rasa.com/t/break-long-answers-into-small-sentences-in-rasa/14829/14 "2021-06-22T17:31:15Z")

</div>

@asc I will encourage not to follow this approach, as user will disconnected from the chat response as it will display the response as per set delay time, rather then I will encourage you please show the response in one go and only in a small paragraph and at the end provide http link [read more…],if the message is long or covering a lot of chat screen. This is the best conversational dialogue approach to engage the user. Hope you understand my points thanks.

But for your actual query it depends on the UI you are using for displaying the messages on the chat screen.

---

<div class="post-metadata">

**Author:** ![WafaaMohammed](https://avatars.discourse-cdn.com/v4/letter/w/c57346/32.png) [@WafaaMohammed](https://forum.rasa.com/u/WafaaMohammed)\
**Post date:** [July 26, 2021, 2:14pm UTC](https://forum.rasa.com/t/break-long-answers-into-small-sentences-in-rasa/14829/15 "2021-07-26T14:14:30Z")

</div>

\n\n is not working for me

---

<div class="post-metadata">

**Author:** ![nik202](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nik202/32/16098_2.png) [@nik202](https://forum.rasa.com/u/nik202)\
**Post date:** [July 26, 2021, 2:33pm UTC](https://forum.rasa.com/t/break-long-answers-into-small-sentences-in-rasa/14829/16 "2021-07-26T14:33:07Z")

</div>

@WafaaMohammed

**domain.yml** under your response

Your text you want to show( not much as it will looks odd in the small widget screen) [read more…] (https:rasa.com]

Example from my other thread solution:

```
utter_what:
 - text: | 
       - what
       - are
       - you
       - doing
       - today 
       - ?

```

This will come line by line, within a few sec.

Next, separate line in one output:

```
utter_what:
  - text : " what \n
             are\n
             you \n 
             doing\n
             today\n
             ?"

```

Do, share the text only few sentences, else customer or user will be bored. Try make a bullet points.

Good Luck! Got it?

---

<div class="post-metadata">

**Author:** ![WafaaMohammed](https://avatars.discourse-cdn.com/v4/letter/w/c57346/32.png) [@WafaaMohammed](https://forum.rasa.com/u/WafaaMohammed)\
**Post date:** [August 14, 2021, 11:33am UTC](https://forum.rasa.com/t/break-long-answers-into-small-sentences-in-rasa/14829/17 "2021-08-14T11:33:30Z")

</div>

@nik202 Thanks for your response. but it doesn’t quite solve my issue.  
your first suggestion returns the sentences as bullet points, there is no delay in time between them. The second suggestion returns the response in one message separated into multiple lines.  
What I am trying to do is the following:  
I am building a chat-bot to provide support for a specific topic, the responses are typically very long paragraphs, I want to split a single response into separate messages that get sent to the user, is there any way I can do that without having to create multiple utterances?

---

<div class="post-metadata">

**Author:** ![nik202](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nik202/32/16098_2.png) [@nik202](https://forum.rasa.com/u/nik202)\
**Post date:** [August 14, 2021, 11:37am UTC](https://forum.rasa.com/t/break-long-answers-into-small-sentences-in-rasa/14829/18 "2021-08-14T11:37:56Z")

</div>

@WafaaMohammed Ohh. sorry to hear that. you need to check yml format to represent messages and read my last line of previous post.

---

<div class="post-metadata">

**Author:** ![BornaGajic](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/bornagajic/32/16241_2.png) [@BornaGajic](https://forum.rasa.com/u/BornaGajic)\
**Post date:** [August 14, 2021, 12:56pm UTC](https://forum.rasa.com/t/break-long-answers-into-small-sentences-in-rasa/14829/19 "2021-08-14T12:56:40Z")

</div>

Multiple utter\_messages are not working on Slack, please look at my post:

> [@Getting multiple messages on Slack](http://forum.rasa.com/t/getting-multiple-messages-on-slack/46865):
>
> Hi, I’m getting multiple duplicates of messages on Slack (same actions gets triggered). When my custom action gets called I get 200 from ngrok, but right after that I get 500 and a http\_timeout error. Also I’ve added errors\_ignore\_retry: | - "http\_timeout" Under slack in my credentials.yml which doesn’t seem to work. Bot is working properly on Rasa shell. After the http\_timeout I also get this error: [1488] [ERROR] Exception occurred while handling uri: 'http://xxxxxxxxxxxx.ngrok.io/…

@nik202 could you also look at this please?

---

<div class="post-metadata">

**Author:** ![findAkash](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/findakash/32/22400_2.png) [@findAkash](https://forum.rasa.com/u/findAkash)\
**Post date:** [March 24, 2023, 4:00am UTC](https://forum.rasa.com/t/break-long-answers-into-small-sentences-in-rasa/14829/20 "2023-03-24T04:00:41Z")

</div>

i am also using [scoket.io](http://scoket.io) channel and this worked for me

```auto
dispatcher.utter_message(text=f"job : {t} \
                                             \n level : {l} \
                                             \n type : {et} \
                                             \n location : {location} \
                                             \n deadtime : {deadline.strftime('%Y %B %d')} \
                                             \n salary : {salary}. \
                                             \n apply : {url}")

```
