Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bot - How to return a newline from Bot to both skype preview and skype web app

I have a Bot app that returns a newline just fine to the Skype preview windows 10 app, using \n\n. However, when I display the message in the web app https://web.skype.com/en/?ecsoverride=developer, it does nor respect the newline breaks and represents it as an ongoing string.

I do not see in the help here: https://docs.botframework.com/en-us/csharp/builder/sdkreference/activities.html ...how to represent a newline regardless of what the client will be - is there some newline that can be used for any client that will receive the message from my bot? If I add something like
it shows as that text in my skype windows 10 app instead of a newline - I'm looking for some newline that works on any client.

Any ideas?

like image 795
Terry Carter Avatar asked Jul 28 '16 05:07

Terry Carter


5 Answers

Update for 3.5 version putting to string \n\n creates a new paragraph. Like the following:

"Paragraph1_text/n/nParagraph2_text" results in

Paragraph1_text
Paragraph2_text

Older versions

I found out that putting two spaces + NewLine symbol solves the problem(C# code):

return $"some text:  {Environment.NewLine}text from new paragraph" 

Or

return $"some text: \ntext from new paragraph" 

The result is

some text:
text from new paragraph 

This works for both: Microsoft Bot Framework emulator and Skype chat

like image 188
Artem Avatar answered Oct 18 '22 19:10

Artem


Inserting HTML line break <br/> works!

like image 7
Aleksey Kontsevich Avatar answered Oct 18 '22 20:10

Aleksey Kontsevich


I use two new lines with a "zero width non-joiner" unicode character.
=> \n\n\u200C
I successfully tested it in Facebook, Skype, Webchat, Emulator.

It also works , if you want blank lines!

like image 5
martinoss Avatar answered Oct 18 '22 19:10

martinoss


A combination of \n\u200C<br> works.

like image 1
hubert17 Avatar answered Oct 18 '22 18:10

hubert17


Adding \r\n to the string being sent works well for many clients.

like image 1
ishaan_awasthi Avatar answered Oct 18 '22 18:10

ishaan_awasthi