Push Notifications/Toasts Summary for Adaptive Cards on Microsoft Teams
Asked Answered
P

1

7

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?

Promote answered 8/7, 2021 at 8:8 Comment(1)
@Steve- we are able to repro this at our end. Checking with engineering team on possible options. I'll keep you updated.Metre
G
3

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.

Ghirlandaio answered 19/7, 2021 at 6:20 Comment(7)
Has there been any progress? Is there a reference number?Promote
We are working on it. I don't have ETA to share but as soon as it is fixed I will let you know.Ghirlandaio
@Steve, This issue is fixed. Could you please check and confirm?Ghirlandaio
Hey @Hunaid, can confirm it's fixed. Thank you for that. :)Promote
Is there a way to also ensure the summary value is shown in the "toast" notification, as opposed to "Bot posted a new message"?Blouson
There doesn't seem to be any wayCarpology
@Prasad-MSFT, Still waiting for this capability :(Richburg

© 2022 - 2024 — McMap. All rights reserved.