I'm experimenting with messaging extensions for MS Teams (using the .net SDK), and I'm running into a problem building a response to a query. I have a handler that can handle the invoke with composeExtension/query, and it works fine if I return a HeroCard, but not an AdaptiveCard. Here's my working HeroCard code:
MessagingExtensionResult result = new MessagingExtensionResult
{
Type = "result",
AttachmentLayout = "list",
Attachments = new List<MessagingExtensionAttachment>(),
};
HeroCard h = new HeroCard()
{
Text = "Hello, my name is Inigo Montoya, you killed my father, prepare to die.",
Tap = new CardAction()
{
Type = "messageBack",
Text = "option1",
},
};
result.Attachments.Add(new Attachment() { ContentType = HeroCard.ContentType, Content = h }.ToMessagingExtensionAttachment());
And here's the version I'm trying with an adaptive card:
AdaptiveCard card = new AdaptiveCard();
card.Body.Add(new AdaptiveTextBlock()
{
Text = "Hello",
Size = AdaptiveTextSize.ExtraLarge
});
card.Body.Add(new AdaptiveImage()
{
Url = new Uri("http://adaptivecards.io/content/cats/1.png")
});
result.Attachments.Add(new Attachment() { ContentType = AdaptiveCard.ContentType, Content = card }.ToMessagingExtensionAttachment());
The code to create the adaptive card is taken directly from the docs.
The documentation on messaging extensions implies that adaptive cards should be supported in this scenario (with type application/vnd.microsoft.card.adaptive). When I get the initialFetch result from the extension, and I return an AdaptiveCard (either alone or with a working HeroCard in the array), I get the "Something went wrong with this app." message in Teams. Is there a way to get this to work?