-1

I have a Web App Bot running on Azure.

It's using the Microsoft Bot Framework Direct Line API 3.0.

I want to use the URL Ping Test type instead of the Multi-Stage Web Test for the Availability Test of the Bot because I do not have the Visual Studio 2017 Enterprise edition.

In the Bot's message controller, this is how I handle the response for Pings. I am able to get expected response in the Bot emulator when running the Bot in localhost.

    else if (message.Type == ActivityTypes.Ping)
    {
        ConnectorClient client = new ConnectorClient(new Uri(message.ServiceUrl));
        var reply = message.CreateReply();
        reply.Text = "{Some message}";
        await client.Conversations.ReplyToActivityAsync(reply);
    }

However, when I connect to the Bot in Azure, I am getting HTTP error 500.

I'm not sure what is the root cause and wonder whether it is due to the URL Ping Test does not know the Direct Line secret.

Appreciate your kind help on this.

Thanks very much.

juvchan
  • 6,113
  • 2
  • 22
  • 35

1 Answers1

2

If you check the “Send an activity to the bot” in Direct Line API 3.0 documentation, you can find:

To send an activity to the bot, the client must create an Activity object to define the activity and then issue a POST request, specifying the Activity object in the body of the request.

URL ping test would sned a GET request to the URL that you specified, it would not hit/trigger the code that you defined for Ping activity in your MessagesController.

If you’d like to detect whether your bot is alive by sending a Ping activity, you could make a request like below from your client.

Request:

POST https://directline.botframework.com/v3/directline/conversations/{conversationId}/activities
Authorization: Bearer {directline_secret}
Content-Type: application/json

Body:

{
  "type": "ping",
  "from": {
    "id": "user1"
  }
}
Fei Han
  • 26,415
  • 1
  • 30
  • 41