当机器人在 Microsoft Teams 中发送自适应卡片时更改通知文本?

Nit*_*hin 0 botframework microsoft-teams

我正在使用 Microsoft BotFramework 开发机器人。当机器人发送自适应卡片时,通知文本为“已发送卡片”。

有没有办法修改这个文本?

小智 5

是的,您可以使用活动的“摘要”属性更改通知上的文本。您可以继续尝试以下示例代码:

var response = MessageFactory.Text(string.Empty);

AdaptiveCard ad = new AdaptiveCard();
ad.Body = new List<AdaptiveElement>() {
new AdaptiveTextBlock()
{
Text= "testing",
Id ="testing"
}
};
Attachment att = new Attachment()
{
Content=ad,
ContentType= AdaptiveCard.ContentType
};
response.Attachments.Add(att);

response.Summary = "showing custom greeeting from the Bot - rather than send a card";
context.SendActivityAsync(response, cancellationToken);
Run Code Online (Sandbox Code Playgroud)