Dispatcher.utter_message multiple line

Hello, I want to show my bot message into multiple line using one unique dispatcher.utter_message I used this method: dispatcher.utter_message( ’ item1 \n item2 \n item3’) but it did’nt work any idea how to do that ?

1 Like

When you say it didn’t work, what do you mean, that the messages came as 3 separate messages?

The message come as one line like there were no ‘\n’

PS: I using the socket IO as a channel along with this UI GitHub - Wolox/react-chat-widget: Awesome chat widget for your React App . Since I found some problems with the one dedicated to rasa.

Hm, it doesn’t look like we strip anything, it might not be anything we have control over. To check, you can add something like

logger.warning("response: {}".format(response))

to the _send_message method in channels/socketio.py in your local rasa_core. This will show you what is being sent to the socketio code that is imported. If it still contains the \ns, then unfortunately we can’t do anything about it. If it doesn’t, then i missed something, let me know!

Yes Rasa does not change the message format. Seems like a problem related to the UI I’m using. Thank you @erohmensing for your help

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

If you have a list of items i suggest that you should use bulletins you can use “\n*”

Example :

utter_message : " \n* item1 \n* item2 \n* item3 " gives output in bulletins :

  • item1
  • item2
  • item3