我试图在我的漫游器/网页上建立反向通道,以便可以在两者之间发送事件。我已经添加了此问题中显示的示例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;
}
但是,ActivityTypes.Event和activity.Name都不存在。我需要一个特殊的程序包来处理Bot框架的反向通道吗?
最佳答案
根据您的评论,似乎您使用的是BotBuilder nuget软件包的旧版本;这就是为什么您没有这些属性/值。
请更新到最新版本的BotBuilder v3.5.5即可。
关于c# - BackChannel通讯不存在ActivityTypes.Event,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/43477855/