c# - 如何使用 C# 在客户端获取建议的卡片操作内容
问题描述
我正在使用 Microsoft BotFramework,当机器人返回建议的 CardAction 时,内容未显示在客户端中。
机器人代码
private static async Task SendSuggestionOptionAsync(ITurnContext turnContext, CancellationToken cancellationToken)
{
var reply = turnContext.Activity.CreateReply("Please choose anyone of this!");
reply.Type = ActivityTypes.Message;
reply.TextFormat = TextFormatTypes.Plain;
reply.SuggestedActions = new SuggestedActions()
{
Actions = new List<CardAction>()
{
new CardAction() { Title = "Fourm", Type = ActionTypes.ImBack, Value = "Fourm" },
new CardAction() { Title = "KB", Type = ActionTypes.ImBack, Value = "KB" },
},
};
await turnContext.SendActivityAsync(reply, cancellationToken);
}
客户代码
var messagesReceived = await _httpClient.GetAsync(conversationUrl);
var messagesReceivedData = await messagesReceived.Content.ReadAsStringAsync();
var messagesRoot = JsonConvert.DeserializeObject<BotMessageRoot>(messagesReceivedData);
它只显示“请选择其中的任何一个!” 在 messgesReceivedData 上,但不显示建议的 CardAction 内容。有人可以帮助确定我在哪里犯了错误吗?我想将建议的 CardAction 内容绑定到我的客户。
机器人输出
{
"id": "QYhDOe6oulCoU55XIoXc5|0000003",
"conversationId": "QYhDOe6oulCoU55XIoXc5",
"created": "2019-01-28T04:56:37.1646158Z",
"from": "sync-test-bot",
"text": "Please choose anyone of this!",
"images": [],
"attachments": []
}
没有论坛,这里显示 KB。
解决方案
不确定答案,但您检查了响应标头吗?在 Outlook 可操作邮件中,卡片内容作为 JavaScript 对象位于 http 标头中。
推荐阅读
- r - 如何使功能的特定部分因主题而异
- kubernetes - 在专用 pod 上运行 Kubernetes cronjob
- c++ - 从文件输入逗号分隔的数字行到结构向量容器?
- python - 错误:[Errno 13] Google 驱动器上的权限被拒绝
- pouchdb - PouchDB 7.2.2 更新文档未持久化
- c# - 为什么我没有让我的主客户在我的房间里?在 Unity 中使用 Photon 制作多人游戏
- c# - 在 MongoDB 中使用 ASP.NET Core 标识
- tensorflow - 在 TensorFlow 图像分类中获取标签
- mysql - docker run mysql image 命令不工作 [MacBook Pro M1]
- php - Cakephp 2 如何对模型进行分页但将结果限制为仅具有条件关联模型的结果