如何从外部源将自适应卡json发送到bot服务api?

时间:2020-06-19 11:54:21

标签: botframework microsoft-teams adaptive-cards microsoft-graph-teams

如何从外部源将自适应卡json发送到Azure Bot Service api?

[添加于2020年8月8日] enter image description here

尝试向api / notify发送自适应卡json或内容以显示ms团队的自定义消息。

只是试图通过创建的通道将自适应卡从Azure Bot Service发送到MS Teams。当前,我已经硬编码了源代码中的详细信息/链接/文本(Azure Bot Services应用程序)。希望通过修改自适应卡的内容来每次发送定制的自适应卡。

当前,如果我呼叫www.sampleAzurebotservices.com/api/notify,则将显示硬编码数据。希望这能给大家一个好印象。

1 个答案:

答案 0 :(得分:0)

@Nanda,选中此documentation,以获取有关如何向bot发送消息的参考。文档中有文字消息,对于自适应卡,您可以在下面的代码段中使用。

var reply = MessageFactory.Attachment(new Attachment { ContentType = AdaptiveCard.ContentType, Content = adaptiveCard }); //pass adaptive card to content
var result = await turnContext.SendActivityAsync(reply, cancellationToken);

让我知道您是否遇到任何问题。