We have a Microsoft Teams project running on a Node server using botbuilder v4.14.0, among other things. This project sends adaptive cards to Microsoft Teams users in a direct message, and for each adaptive card we set a summary text for the purpose of rendering in the push notification the end user receives.
Something along the lines of this suggestion, we set the message summary field:
var response = MessageFactory.Text(string.Empty);
response.Attachments.Add(cardAttachment);
response.Summary = "Hello custom notification";
await turnContext.SendActivityAsync(response, cancellationToken);
The problem we have is that sometimes this appears correctly in the push notification, but other times it appears entirely blank. What's more, the name of the app is different in the push notification - for notifications with the correct summary, the name of the app is pulled from our Azure Application Service metadata, but when the summary is missing the name is somehow pulled from the Teams app manifest file.
Example of different notifications
In both cases, the payloads are normal adaptive cards, delivered exactly through the same code. We explored any differences we could find between the two different adaptive cards and found nothing meaningful. One just worked while the other just didn't.
Digging in further, we found that by modifying the size of the payload, we could make an adaptive card that failed to render a notification start working. To make an adaptive card render the summary field in the push notification, we added additional text until a threshold was exceeded.
For instance, measured in bytes, we found that one particular adaptive card would start to render the summary field after 1888 bytes, but would not render the summary at 1887 bytes. However, another adaptive card, structurally different than the first example, would render the summary at 1781 bytes, but not at 1780.
Why does the summary start rendering at one payload size vs a smaller one? Why is the payload size inconsistent between the two payloads? Why are the names different? So many opaque questions.
Ultimately, how do we send adaptive cards so that they always render the summary in the push notification?
Edit: In testing, it appears that push notification summaries appear correctly for Teams Web, Desktop, and Android notifications. They do not work consistently for Teams iOS notifications.