Skip to main content

Notifications

Handling Adaptive Cards Version Mismatch Issue

Priyaranjan_6-1647964616383.png

 

 

Introduction

Problem Statement

Solution

Summary

 

Introduction

 

Adaptive Cards is a way in which Developers can exchange data and content in a common way and the JSON payload used for creating the card can be used in any device or UI Framework. In addition to that there is no programming requirements for building these cards as the structure is completely defined by JSON(JavaScript Object Notation).In addition to it, we can style the card in a standard way so that it appears consistently across different platforms.

We can use the adaptive card designer to design the JSON for the adaptive card.

 

Priyaranjan_0-1647964606176.png

 

We have covered a few articles on how to work with Adaptive Card JSON to render the cards in Teams below  :

 

Problem Statement

However, while adding the generated JSON to the Power Automate Post adaptive card in chat or channel was throwing the error “We are sorry, this card couldn’t be displayed”

 

Priyaranjan_1-1647964606179.png

 

 

Solution

 

There can be multiple reasons for this especially if the JSON is not formatted correctly as per syntax. But one of the possible causes if we are copy pasting the developed JSON from Adaptive card designer is that, it targets version 1.5 by default. Taking a look at the official documentation, the supported versions in Microsoft Teams are 1.4 for Bot card cards and 1.3 for User sent cards. This holds true as of Jan 2022 and may change in the subsequent months as new updates are rolled out to Teams Platform

Priyaranjan_2-1647964606183.png

 

We can either change the target version in the adaptive card designer while working on the JSON as below:

 

Priyaranjan_3-1647964606188.png

 

Or we can easily change it directly in the JSON schema by updating the version number to 1.4 or less:

 

Priyaranjan_4-1647964606192.png

 

 This will fix the issue with the rendering of the adaptive card.

Note: Since we are working on a Bot Sent Card, we have downgraded to v1.4, in case you are working on a User sent card, ensure to downgrade to v1.3. This downgrade holds good as of Jan 2022 and in the future when updates are rolled out to Teams, higher schema versions would be supported.

 

Priyaranjan_5-1647964606196.png

 

Summary

Thus we saw a potential issue that would cause problems with the rendering of the adaptive cards in Teams due to mismatch in supporter version number and the ways to solve it.

 

 

Comments

*This post is locked for comments