【发布时间】:2020-03-06 13:46:55
【问题描述】:
我正在尝试发送Teams notification 和hero card 或Adaptive Card。我可以发送一条简单的短信作为notification。
我不知道如何将Hero card 或Adaptive Card 包装在Activity 中,因为SendToConversationAsync 只接受Activity。
【问题讨论】:
标签: botframework
我正在尝试发送Teams notification 和hero card 或Adaptive Card。我可以发送一条简单的短信作为notification。
我不知道如何将Hero card 或Adaptive Card 包装在Activity 中,因为SendToConversationAsync 只接受Activity。
【问题讨论】:
标签: botframework
这是您可以用来发送使用adaptivecard.io创建的任何卡片的代码
const resultOutputCard = {
"type": "AdaptiveCard",
"version": "1.0",
"body": [
{
"type" : "TextBlock",
"text" : "Sample Text"
}
],
"actions": [
{
"type": "Action.OpenUrl",
"title": "Google Link",
"url": "www.google.com"
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json"
};
const card = CardFactory.adaptiveCard(resultOutputCard);
await step.context.sendActivity({ attachments: [card] });
下面是发送英雄卡的代码
const { MessageFactory, CardFactory } = require('botbuilder');
const card = CardFactory.heroCard(
'White T-Shirt',
['https://example.com/whiteShirt.jpg'],
['buy']
);
const message = MessageFactory.attachment(card);
await context.sendActivity(message);
以下是您可以找到上述示例的链接。
【讨论】: