Botframework-sdk: Send multi-line replys or send multiple replies to make it look multi-lined

Created on 2 Apr 2016  Â·  13Comments  Â·  Source: microsoft/botframework-sdk

In providing options to my users to help them with the Luis intent I wanted to add a help command. However it looks all messed up when I try to reply with new-lines. Trying to do it in multiple calls such as this

await context.PostAsync($"Ok! {message} start off the game.");
await context.PostAsync($"{_options}");
only desplays the first. I followed the example of Alarm bot and it works similar. Search on the documentation or some more examples would be great.

Thanks
Kevin

bug

Most helpful comment

We use markdown, so you need an extra cr to make a new line. See http://docs.botframework.com/connector/message-content/#navtitle
line 1 \n\n
line 2\n\n
The PostAsync should work as long as the second one is not empty. If you send an empty message it is ignored.

All 13 comments

We use markdown, so you need an extra cr to make a new line. See http://docs.botframework.com/connector/message-content/#navtitle
line 1 \n\n
line 2\n\n
The PostAsync should work as long as the second one is not empty. If you send an empty message it is ignored.

Awesome! thank you, I can't believe I missed that!

I've tried sending multiple replies using the context.PostAsync method and it sends the first message successfully but it never sends the next message. I've verified it is not empty and since I await the method I don't actually hit the break point on the other side of the second await contexts.PostAsync. Is there some function I have to call after a post async to allow me to send another? I'm using a LuisDialog and I'm trying to send back messages before and after processing some information. here is the method that I'm using
public async Task PlaceMarker(IDialogContext context, LuisResult result) { bool invalid = false; if (_playing) { _ticTacToeBoard.PlaceMarker(marker, loc); _isPlayerTurn = false; await context.PostAsync($"Interesting Move \n" + $"{_ticTacToeBoard}"); if (_ticTacToeBoard.GameOver) { SendEndGameNotification(context, _ticTacToeBoard.Winner); } _ticTacToeBoard.SelfMove(); await context.PostAsync($"My move is: \n" + $"{_ticTacToeBoard}"); _isPlayerTurn = true; if (_ticTacToeBoard.GameOver) { SendEndGameNotification(context, _ticTacToeBoard.Winner); } } } } context.Wait(MessageReceived); }
I've cut out some of the verification code I have to make it a little smaller but appreciate the help.

When you send multiple PostAsyncs, we start up the ConnectorClient to send the message out of line with the initial http request. By default, this message goes to the production deployment. We're working to make this configurable, so that it can be sent to the emulator as well.

You can send it to the emulator now. To do you change your connector client like this:
var client = new ConnectorClient(new Uri("http://localhost:9000/api/messages"), new ClientCredentials());

This will instantiate a client pointing to the port that the emulator is listening on. With this you should be able to send async messages.

So sending two messages in a row is something that is going to be possible at some point? How often are they going to release new betas?

We've published the updated nuget that automatically redirects multiple messages to the emulator if you're running with the emulator.

"\n\n" will create a paragraph break. but if you want just a line change, put two spaces before a single line change: "  \n"

Hello. Whether there is new information with regards to sending several messages in succession is not an emulator, in public channels (webchat, skype, telegram)?

I don't understand your question, can you restate?

Sent from my tumbs


From: FordSoftmailto:[email protected]
Sent: ‎5/‎9/‎2016 2:24 AM
To: Microsoft/BotBuildermailto:[email protected]
Cc: Tom Laird-McConnellmailto:[email protected]; Commentmailto:[email protected]
Subject: Re: [Microsoft/BotBuilder] Send multi-line replys or send multiple replies to make it look multi-lined (#33)

Hello. Whether there is new information with regards to sending several messages in succession is not an emulator, in public channels (webchat, skype, telegram)?

—
You are receiving this because you commented.
Reply to this email directly or view it on GitHubhttps://github.com/Microsoft/BotBuilder/issues/33#issuecomment-217816785

Hello.

Why in the emulator when I call this code:
await context.PostAsync("1");
await context.PostAsync("2");
await context.PostAsync("3");
bot returns all three values (1,2,3) and webchat/telegram just the first (1)

How do I get all three values ?

any information?

I am having this issue as well. I get an "Access Denied" error.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kenyeung128 picture kenyeung128  Â·  3Comments

mattlanham picture mattlanham  Â·  3Comments

jschristophe picture jschristophe  Â·  3Comments

Vigneshramkumar picture Vigneshramkumar  Â·  3Comments

akakoychenko picture akakoychenko  Â·  3Comments