Carousal image is showing different size - botframework

I have given same size images in carousal card but when its showing to directline channel first image showing small but azure bot its showing correctly.

These cards are rendered in different channels and every channel has the capability to control its own UI. Probably that could be the reason the card is properly aligned in the web chat channel.
Create your own css for the directline channel.

Related

Microsoft Teams push notification is blank for some adaptive cards

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.

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?

Teams Chatbot,Adaptive Card text clears on Teams Page Refresh

Working on a chatbot with botframework on teams, while testing we noticed the Adaptive card input texts clears,when teams chat is refreshed(i.e if we scroll up or if we switch to some other chat in the window and switch back) before submitting the card.
I guess this probably has something to do with page refresh,Could there be any workaround for this?
Note:-Earlier faced a diff type of issue where after clicking submit on adaptive card the text vanishes but that was resolved via replacing the card with the values/Text with update activity.
Since this is totally teams UI end,Any possible solutions?
Text from Adaptive card is cleared out on Submit. This is the default behaviour. However, all the values you send from the card will be shown up under turnContext.activity.value
Teams clears out the data from Adaptive Cards on submit, that is inbuilt. However you can work around this by instead updating/re-populating the card with the user input.
See this answer to know how to repopulate cards

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.

Markdown is not working in the Bot Framework Twilio channel

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!

Resources