2

Referencing this closed issue: https://github.com/Microsoft/BotBuilder/issues/920

I have the same problem as the author, on Facebook channel: I'd like to add line breaks but I can't. I tried things I saw on other threads like <br>, <br />, &nbsp; , \n \n, \r\n, \r \n... Nothing works.

In my below examples, ServicesToDisplay is just an array of strings joined by ' \n' (space space \n, because bot framework strings are as I saw, in Markdown). Only one thing works, adding a random string:

session.send(`Interventions le ${results.response.entity}:

qwe


${servicesToDisplay}`);

Leads to well interpreted line breaks:

https://puu.sh/wrdV5/3719ccf115.png

And without the string:

session.send(`Interventions le ${results.response.entity}:



${servicesToDisplay}`);

It leads to no line break:

https://puu.sh/wrdYs/42d23f7c36.png

Do you have any idea on how to perform the same behaviour without the string between ?

Pierre Hofman
  • 175
  • 1
  • 15

1 Answers1

1

I know its so late, but I made it work by using the following,

Let your message to send is: "hello \n how are you \n\n :)", Then before sending it through the API, format it like ,

message = message.replace(/\\n/g, '\n');

Send this message using API, and you will get the line breaks. It worked for me.

Jerin A Mathews
  • 8,572
  • 4
  • 26
  • 49