1

I'm trying to set up a backchannel to my bot/web page so I can send events between the two. I've added the example shown in this question Bot framework get the ServiceUrl of embedded chat control page

public async Task<HttpResponseMessage> Post([FromBody]Activity activity)
{
    if (activity.Type == ActivityTypes.Event &&
        string.Equals(activity.Name, "buttonClicked", StringComparison.InvariantCultureIgnoreCase))
    {
        ConnectorClient connector = new ConnectorClient(new Uri(activity.ServiceUrl));

        // return our reply to the user
        Activity reply = activity.CreateReply("I see that you just pushed that button");
        await connector.Conversations.ReplyToActivityAsync(reply);
    }

    if (activity.Type == ActivityTypes.Message)
    {
        ConnectorClient connector = new ConnectorClient(new Uri(activity.ServiceUrl));

        // return our reply to the user
        var reply = activity.CreateReply();
        reply.Type = ActivityTypes.Event;
        reply.Name = "changeBackground";
        reply.Value = activity.Text;
        await connector.Conversations.ReplyToActivityAsync(reply);
    }
    else
    {
        HandleSystemMessage(activity);
    }
    var response = Request.CreateResponse(HttpStatusCode.OK);
    return response;
}

However ActivityTypes.Event does not exist as well as activity.Name. Do i need a special package to handle backchannel with the bot framework?

Community
  • 1
  • 1
Teragon
  • 239
  • 3
  • 13

1 Answers1

3

Per your comments, it seems you are using an older version of the BotBuilder nuget package; that's why you don't have those properties/values.

Please update to the latest version of BotBuilder v3.5.5 and that will make it.

Ezequiel Jadib
  • 14,767
  • 2
  • 38
  • 43