botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

[Facebook Messenger] Newlines stripped out when sending messages

Open MironV opened this issue 10 years ago • 21 comments

Sending messages seems to strip out multiple newlines (to create whitespace). Newlines are supported on FB Messenger but when I route them through Bot Framework they seem to disappear.

MironV avatar Aug 06 '16 08:08 MironV

I've seen this too. Adding Tom.

Stevenic avatar Aug 06 '16 21:08 Stevenic

Any news? I've just hit that. It works in the emulator but on skype the newlines are missing. I use two whitespaces and then a \n.

letmaik avatar Aug 31 '16 10:08 letmaik

Since by default everything parsed as markdown you can put \n\n to have new paragraph in Skype and Facebook:

"Lorem ipsum dolor sit amet, \n\n consectetur adipiscing elit. \n\n Duis eleifend efficitur orci, id semper leo feugiat at. Morbi pharetra massa sit amet nisi semper, sed pellentesque tellus egestas. \n\n Praesent ipsum enim, mollis ac imperdiet in, faucibus ut odio. Proin ut dui nisi."

Facebook: image

Skype: image

Slack: image

webchat: image

msft-shahins avatar Sep 01 '16 00:09 msft-shahins

That seems to produce indented paragraphs. Is there a way to produce block paragraphs (i.e., create blank lines)? A lot of my content is really hard to read otherwise.

MironV avatar Sep 01 '16 00:09 MironV

@MironV

I have the same question. @msft-shahins closed my issue, which detailed this exactly.

b0yfriend avatar Sep 01 '16 02:09 b0yfriend

@MironV this should be fixed now. Use standard markdown \n (two whitespace and \n) to insert a line break.

Text = "Lorem ipsum dolor sit amet,  \nConsectetur adipiscing elit.  \nDuis eleifend efficitur orci, id semper leo feugiat at. Morbi pharetra massa sit amet nisi semper, sed pellentesque tellus egestas.  \nPraesent ipsum enim, mollis ac imperdiet in, faucibus ut odio. Proin ut dui nisi."

Facebook image

Skype image

Webchat image

msft-shahins avatar Sep 02 '16 22:09 msft-shahins

Are you sure this is completely solved? We are now seeing an additional blank newline at the end of most messages (tested via skype). I haven't tested the on-purpose newlines yet.

letmaik avatar Sep 09 '16 15:09 letmaik

@letmaik Feel free to file another issue with the markdown causing the behavior that you are observing.

msft-shahins avatar Sep 09 '16 17:09 msft-shahins

@letmaik that sounds like issue #1025 which I filed some time ago. Looks like it hasn't been fixed yet.

MironV avatar Sep 09 '16 17:09 MironV

I am still not able to create blank lines. Is this really fixed?

@msft-shahins your example does not contain blank lines.

euanlau avatar Dec 01 '16 01:12 euanlau

I can create a new line but can't seem to create a line between them...

Hey,  \n  \nI\'m TestBot

Hey,
I’m TestBot

Any ideas how to get an extra blank line?

gilesbutler avatar Dec 26 '16 10:12 gilesbutler

@gilesbutler try line 1<br/><br/>line 3

euanlau avatar Jan 07 '17 01:01 euanlau

Thanks @euanlau - unfortunately due to a family bereavement I can't test this right now. Once I'm back online I'll test and update here.

gilesbutler avatar Jan 16 '17 03:01 gilesbutler

Hi, I am also trying to get lines between sentences to break up longer paragraphs

McGern avatar Feb 28 '17 14:02 McGern

Same issue here, after a lot of trial and error the only way to create blank lines (in the emulator) I have found is the following one:

var text1 = `Line1

&nbsp;
&nbsp;
  
Line3`;

which gives you: Line1

Line3

But don't ask me why ;)

laidbackindustries avatar Mar 21 '17 07:03 laidbackindustries

I'm not sure I understand. It's pretty clear what the issue is and that people are continuing to encounter it. What more is specifically required that can't be parsed from this thread?

MironV avatar Apr 10 '17 20:04 MironV

@MironV are you using C# or Node SDK?

nwhitmont avatar Apr 18 '17 20:04 nwhitmont

Not sure what @MironV uses but I'm seeing this error in Node SDK

laidbackindustries avatar Apr 19 '17 06:04 laidbackindustries

I have the same issue, I can't have a new line in Facebook channel. I tried all solutions I saw on this thread and in other places (<br>, <br />, nbsp; , \n \n, \r\n, \r \n...) Is there a solution available and approved ?

hofman-p avatar Jun 22 '17 09:06 hofman-p

Here is a new element I found:

Leads to this:

And if I take out the letters:

It then leads to this:

Trying to replace 'qwe' by nbsp; doesn't work, it just displays nbsp; in chat.

hofman-p avatar Jun 22 '17 10:06 hofman-p