Search code examples
microsoft-teamsadaptive-cardsteams-toolkit

Adaptive card not visible in preview mode in a Channel


We started seeing a weird issue these days. The adaptive card is not visible in Preview mode in Channel but in chat its visible. I tested a lowest Adaptive card with just one text, and I see the same behavior.

In Chats

enter image description here

enter image description here

In Channel:

enter image description here

Its blank completely. But when you click on Send, the card is posted perfect in Chat.

This is the code:

import { Attachment, CardFactory } from "botbuilder";

export class CustomerResultCard {

    public static getCard(type: string): Attachment {        
        const card =  CardFactory.adaptiveCard(
            {
                "type": "AdaptiveCard",
                "body": [
                    {
                        "type": "ColumnSet",
                        "columns": [
                            {
                                "type": "Column",
                                "width": "stretch",
                                "items": [
                                    {
                                        "type": "ColumnSet",
                                        "columns": [
                                           
                                            {
                                                "type": "Column",
                                                "items": [
                                                    {
                                                        "type": "TextBlock",
                                                        "size": "Large",
                                                        "weight": "Bolder",
                                                        "text": "Entity Type:" +type+ " not supported",
                                                        "height": "stretch"
                                                    }
                                                ],
                                                "height": "stretch",
                                                "style": "default",
                                                "width": 65
                                            }
                                            
                                        ],
                                        "height": "stretch"
                                    }
                                ],
                                "style": "default"
                            }
                        ]
                    }
                ],
                "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
                "version": "1.3"
            }
        );

        return card;
    }
} 

Solution

  • The bug is resolved and we can see adaptive card in Channel preview