Microsoft Teams push notification is blank for some adaptive cards - microsoft-teams

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.

Related

Mark an Adaptive card posted via Incoming webhook in MS Teams as done

We get messages/tasks from an external PHP-server via incoming webhook in a Teams channel. They are posted in the Adaptive Card format using the 'message with attachments' method.
I would like to find a possibility to mark these messages as done.
My idea would be that the message has a button, that turns green and maybe changes the text when clicked. This has to be permanent. Also the text of the card should be hidden.
I tried to implement a button that toggles the visibility of the card, but it turns out the toggle is not persistent but gets reset every time the channel is opened.
As a workaround we are using reactions at the moment, but I would like to find a more obvious way.
Obviously an incoming webhook does not support the use of Action.Submit (as stated in the link above). So I cannot obviously update the card with this method.
I was thinking to use the Post adaptive card and await answer -method from Flow, but it cannot post an answer to a post, but only post a new card, so the context is missing, which of the posts in the channel you ant to mark as done.
A Power automate Flow could achieve this, if it could be told to alter the posted message.
I realize that it is actually a Task I want to post, not necessarily a message/card in a Teams channel. But there seems no way to post a new task directly to a Tasks tab in a Teams channel via an incoming webhook?
Has anybody an idea what technique could be used to achieve my goal?
This is possible using Actions with O365 connector card format, and is not a currently supported feature in Adaptive cards,
Ref Doc: ⁠Create and send messages - Teams | Microsoft Docs
Could you please raise an User Voice

Can you use Power Automate to Repost an Adaptive Card Bot Post to Another Channel?

I've built a Power Automate flow that posts an adaptive card to a channel I've designated as a "Notification" channel. Sometimes these notifications require discussion but to avoid the order changing in Teams and new notifications being buried I've locked the channel.
I've built a "For a selected Message" Instant flow which can copy a selected message to another channel, but it fails any time I attempt to copy the contents of the message and I can only post a link.
The Adaptive card itself is good, I just can't use the copy plain text or copy post dynamic variables without an error in the flow saying 'the adaptive card is invalid'. This would be caused by attempting to post what is effectively one adaptive card inside of another.
Does anyone have a solution for this or have an idea of where I could find a work around?

Maximum Number of Adaptive Cards on Carousel - Microsoft Teams

In Microsoft Teams, what is the maximum number of adaptive cards that can be stacked on a carousel using Bot Framework? Is there any official docs on this?
I looked in the Bot Framework source code and didn't see anything that seems to limit the number of attachments you can attach to a message. This seems to indicate that any limitations would be based on the channel that's rendering the attachments and not based on the Bot Framework.
The Attachments property is an IList<Attachment>. While Lists have 32-bit integer indexes, you're sure to run out of memory if you try to use int.MaxValue. I tried adding as many attachments as I could and the process seemed to get stuck at iteration number 8,115,461. Limiting it to 1,000,000 attachments, I was able to create the message but hit an exception when I tried to post it. With 100,000 attachments, I could get the message to send in the emulator but couldn't view the message in the inspector. With 10,000 attachments, I could see all of the attachments in the inspector but couldn't send the message in other channels once I published the bot.
In the end it looks like 10 is the maximum number of Adaptive Card attachments you can have in a message sent through Microsoft Teams. Even if this limitation wasn't in place, I'd recommend not putting more than 10 attachments in a carousel anyway. There is some documentation here, but it seems to pertain to email messages and doesn't mention cards.

Windows interactive notifications

So I want to know how a quickreply toast can be sent to the right person and when you click on it, it goes to the specific person.
Example 1:
Person A texts me, I pull down on the interactive notification and type my response and it gets processed by the background process. How does the applications know that my response goes to Person A. is there an attribute in the XML of the toast that can be a variable, like the phone number?
Example 2:
Person A posts a picture on my facebook, I click on the notification and it takes me to the page on facebook. Again is there an XML variable with a URL of it or something?
You can download this Microsoft Windows UWP sample, where you can see what code they use to manage notifications.
I think that you need Toast notifications:
Toast notifications are small pop ups that appear on the screen for few seconds. They convey messages and can be customized to even play different sounds. New to Windows 10 are actionable toasts where a user has a choice to interact with the notifications by use of a button, for example.

Custom Push Notifications

I am building a very basic information based app (Android) for an event, and i'd greatly appreciate your help on the questions below.
Basically, the app will just contain information about the 7 guest speakers at the event.
The attendees (2500 android users) will only get the link to the Android app when they arrive at the venue.
There is no database connected to the app as it just contains static information about the speakers which is hard coded into the app, however i want to build in a small feature so that i can send out custom push notifications to all users (let's assume 2500) at various times, such as when a speak is about to start on stage etc.
QUESTIONS
01 - am i right in saying that Parse allows you to send out custom push notifications in bulk from the Parse dashboard?
02 - is it able to send to 2500 at one time or do they need to be sent out in smaller batches?
03 - at what stage do charges start to occur for all of these custom push notifications
Thanks in advance for your help, it's much appreciated.
01. Yes Parse dashboard enables you to send push notifications in bulk.
02. Yes it is able to send as many push notifications as needed you needn't worry about batches since Parse dashboard is a simple GUI frontend made by Parse.com so you don't do any coding.
03. You can see on this link https://parse.com/plans that per app you have 1 million unique pushes. Unique push is equal to 1 push on 1 device. To be clearer a single user might have 5 devices registered to him so sending a push to 1 user does not mean 1 push but 5 pushes 1 for each device.
**One more thing to note if you are going to be making custom pushes you should think about handling the push notification in the Android app if you plan on doing anything fancy. If its just to show the push with text then you need the basic handling of an incoming push that does nothing once the app is opened by a push notification.

Resources