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.
Related
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.
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?
I have created a bot using bot framework (.net) with application hosted media using the sample provided here. Bot attends any incoming peer to peer or group calls in Microsoft Teams. While in the meeting I am able to receive audio buffers as participants speak up in AudioMediaReceived event handler inside CallHandler.cs class provided in the samples. Now I want to generate transcript out of it. I want some guidance about:
Can this be done at the end of the meeting, I am confused as it's stated on a number of places (1)(2) that
"You may not use this SDK to record or otherwise persist media content
from calls or meetings that your bot accesses"
.
In which scenario this fits? Is it possible to generate wave(.wav) file out of the byte array (UnmixedAudioBuffer data) received and use that for transcription at the end of the meeting?
Since we receive audio frames at a very quick pace (50 frames per second), If I am to generate the transcript asynchronously and real time, how should I do it. Is it about converting buffer data to .wav or in memory stream and using some cloud speech service/API?
There's a speech service provided by Microsoft as well as speech to text resource provided by Google cloud.
your guidance is highly appreciated.
It's a bad idea to try to get a bot to transcribe meetings for you for the reasons you've already seen. However, you're in luck because Microsoft already transcribes meetings automatically.
You can record a meeting in Teams by following the instructions here: https://support.microsoft.com/en-us/office/record-a-meeting-in-teams-34dfbe7f-b07d-4a27-b4c6-de62f1348c24
If you save the recorded meeting to Microsoft Stream then you can even edit the transcript. If you save the meeting to OneDrive and SharePoint then this page implies the feature should be available in the future: https://support.microsoft.com/en-us/office/edit-the-transcript-of-a-meeting-recording-in-teams-2f461386-e39a-4444-b9e2-5787da1da11b
I'm trying to send files to a channel in Teams, but I've found examples of asking a bot for something (for example I write 1 and he send me an image), and the bot's able send images or files like attachments (I don't need adaptive cards or message cards if your idea is Incoming webhook).
I need to send with a schedule request attachment files to teams, is that possible? For example, if such is possible to send a set of image attachment every 1 hour.
Thanks
In case this is still not resolved.
Please take a look at Send and receive files through your bot doc to see how your bot can send/receive file attachments.
For bot to trigger message based on backend trigger, please take a look at Send
proactive messages.
Sample code for both of these scenarios can be found in Bot Framework sample code repo.
I am trying to create a simple bot that sends images and hyperlinks by SMS using Twilio (trial account).
I do get the reply from the bot , but none of the markdown is working, even simple markdown elements like text or bing
Sample code I am using to send the message through Twilio SMS channel:
public async Task<Message> Post([FromBody]Message message)
{
if(message.Text == "Hello")
{
string messageText = "![Sample Image](http://aka.ms/Fo983c)";
return message.CreateReplyMessage(messageText);
}
Am I missing something? The emulator displays the image and other markdown properly, but when I test using my android phone and text the Twilio number to connect to the bot, it delivers raw HTML and not the rich content.
Twilio developer evangelist here. As pointed our earlier SMS is text only, so markdown or any other formatting will not work.
I just tried sending a message from a bot, and while I get the image correctly on the emulator or webchat, on SMS I only get the URL of the image (i.e. http://aka.ms/Fo983c).
According to the documentation, this is the expected behavior as it states:
Not all channels can represent all markdown fields. As appropriate
channels will fallback to a reasonable approximation, for example,
bold will be represented in text messaging as bold
So I guess for images, it will always fallback to the URL of the image.
As for sending MMS, it appears right now the botframework doesn't support it. To be clear, Twilio itself does support MMS for US and Canada, but it seems Microsoft's implementation didn't take advantage of that right now.
Hope this helps you.
I did this when I was first trying out the framework. Sorry but I don't have that code anymore however I don't recall having to do anything special. I simply sent a picture from my phone to my twilio number and then in the message properties for the message received by the bot there was an attachment field with a URL pointing to the image sent from my phone. Then I used a regular web request to pull down the image.
The details for the attachment objects and content url fields are outlined here.
Because there's no way to emulate the SMS channel you'll have to publish the code live to be able to test it out.
Have fun!