webhooksmicrosoft-teamsadaptive-cards

Push Notifications/Toasts Summary for Adaptive Cards on Microsoft Teams


I've built a few tools that send messages via webhooks to Microsoft Teams and I decided to switch to Adaptive Cards to make the messages sent a bit more easy to read and laid out, since Adaptive Cards can be stylised a lot more than the standard MessageCard (0365 Connector) and I've managed to achieve that but unfortunately hit a bit of a snag at the finish line.

When a push notification is sent with an Adaptive Card, instead of giving a brief breakdown or first few lines of the message, it simply says Card. It also shows this way as well under the Notifications tab of Microsoft Teams (PC or Mobile), so as you can imagine it's a little irritating since I send out a lot of messages and you need to actually tap/click thru to read them without seeing a summary beforehand.

In the old style/O365 connector, I would simply use the summary field and it would work just fine.

//O365 Connector
    "@type": "MessageCard",
    "@context": "http://schema.org/extensions",
    "summary": "John Doe commented on Trello",
    "title": "Project Tango",

I've seen the following provided as advice for Bot Frameworks:

var response = MessageFactory.Text(string.Empty);
response.Attachments.Add(cardAttachment);
response.Summary = "showing custom greeeting from the Bot - rather than a card";
await turnContext.SendActivityAsync(response, cancellationToken);

But that does not apply here since I am using webhooks... but I tried Summary as a key in the payload to see if it helped and it didn't.

https://adaptivecards.io/schemas/adaptive-card.json [schema]

I took a look at the adaptive-card.json schema and I can't see anything in there that would come close to looking like it would impact the toast/push notifications either. I did try fallbackText but I think that's only used in the event the renderer is unable to load the adaptive-card, and not used at all for the summary.

Any ideas? or does utilising adaptive cards mean I need to sacrifice the ability to summarise information in notifications/toasts?


Solution

  • UPDATE

    Issue is fixed. You can try sending the JSON below

    {
       "type":"message",
       "summary": "my summary",
       "attachments":[
          {
             "contentType":"application/vnd.microsoft.card.adaptive",
             "contentUrl":null,
             "content":{
                "$schema":"http://adaptivecards.io/schemas/adaptive-card.json",
                "type":"AdaptiveCard",
                "version":"1.2",
                "body":[
                    {
                    "type": "TextBlock",
                    "text": "For Samples and Templates, see [https://adaptivecards.io/samples](https://adaptivecards.io/samples)"
                    }
                ]
             }
          }
       ]
    }
    

    Currently there are no workaround for this issue, we have raised bug to engineering team to track this internally. We will let you know once we have updates on this.