简体   繁体   中英

Change notification text when bot sends an adaptive card in Microsoft Teams?

I am developing a bot with microsoft BotFramework.When bot sends an adaptive card the notification text is "Sent a Card".

Is there a way to modify this text?

Yes, you can change the text on the notification using "Summary" property of an activity. You can go ahead and try out this sample code:

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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM