2

Can anyone give a specific C# example of sending a message to a bot and waiting for the reply? I'm trying to test a bot without using the emulator, so I can have more control and see more details. I've read documentation about the different REST APIs, but I'm really not sure how to specifically implement these in a C# program.

I think I can start it with:

using Microsoft.Bot.Connector;
var client = new ConnectorClient(appID, appSecret);

But I don't know where to go from there. I want to test sending a message from a user to a bot, and then waiting for the bot to respond, and then displaying the response message.

Thanks for any help.

jackarms
  • 1,343
  • 7
  • 14
  • What is a `ConnectorClient`? Is this a C# library/Nuget package you are using? – pay Jun 17 '16 at 17:05
  • It's defined in `Microsoft.Bot.Connector` but I can't find proper documentation for how to use it. – jackarms Jun 17 '16 at 17:08
  • In that case, it looks like this: http://docs.botframework.com/connector/getstarted/#navtitle should be very helpful to you. – pay Jun 17 '16 at 17:09
  • 1
    Yes, I've read through that page many times. As the question said, I'm trying to write my own client program, not use the provided bot emulator. – jackarms Jun 17 '16 at 17:12
  • Hm, it's a bit confusing then, so you don't want to use the `ConnectorClient` class? – pay Jun 17 '16 at 17:22
  • I do want to use it, since I believe it's used to send and receive messages, but I don't know how, so I'm looking for a specific example of how to do so. – jackarms Jun 17 '16 at 17:30
  • Then it is more confusing, I see sections of the previous documentation titled `Replying to a message`, `Starting a conversation`, `Composing Messages`, `Message Types`, etc. None of these sections explain how to "send an receive messages" as you say? – pay Jun 17 '16 at 17:32
  • Not sending and receiving in a single program. – jackarms Jun 17 '16 at 18:39

1 Answers1

0

I tried with direct API. That is not much difficult. Please browse the link below.

Example code here

Community
  • 1
  • 1
SilentCoder
  • 1,970
  • 1
  • 16
  • 21