I cant see my adaptive card on the Bot builder emulator, it appears as blank

Question:

I’m using Python Bot Builder framework and I’m testing it on the emulator.
Now I know that my adaptive card JSON file is perfect because it show’s all the data as I desired on both VisualStudio Code and https://adaptivecards.io/designer/.
However when I run the emulator my adaptive is completely blank.

Now the code I’m using for my adaptive card is:

    def adaptive_flight_card_attachment(self):
        JSONFileName = 'QuickAdaptiveJSONfile.json'
        file_path = "AdaptiveFlightCardFile"
        
        if os.path.exists(file_path):
            files_in_dir = os.listdir(file_path)
            if JSONFileName in files_in_dir:
                file_path = os.getcwd()+f'/{file_path}'+f'/{JSONFileName}'
                    with open(file_path, "r+", encoding="unicode_escape") as in_file:
                        card = json.load(in_file)
                            return Attachment(content_type="application/vnd.microsoft.card.adaptive", content=card )

I then run this using:

FlightDetailCard = self.adaptive_flight_card_attachment()
response = MessageFactory.attachment(FlightDetailCard)
await turn_context.send_activity(response)

Somewhere in here I’m making a mistake and I can’t seem to pin point where. So can anyone please help me out here?

  • This is how my adaptive card appears (The two empty rectangles on the bottom of the chat):
    enter image description here
  • And this is how they’re supposed to be (The boarding pass on the right of the screen):
    enter image description here
Asked By: KingKong BigBong

||

Answers:

look like issue in the json file.

enter image description here

Answered By: Vinoth Rajendran

For what’s it’s worth, I ran into the same issue with the .NET 6 Command Bot sample in Visual Studio 2022 Teams Development Kit. I had to update the adaptive card schema (http://adaptivecards.io/schemas/adaptive-card.json) from version 1.4 to version 1.3:

{
  "type": "AdaptiveCard",
  "body": [
    {
      "type": "TextBlock",
      "size": "Medium",
      "weight": "Bolder",
      "text": "${title}"
    },
    {
      "type": "TextBlock",
      "text": "${body}",
      "wrap": true
    }
  ],
  "actions": [
    {
      "type": "Action.OpenUrl",
      "title": "Bot Framework Docs",
      "url": "https://docs.microsoft.com/en-us/azure/bot-service/?view=azure-bot-service-4.0"
    },
    {
      "type": "Action.OpenUrl",
      "title": "Teams Toolkit Docs",
      "url": "https://aka.ms/teamsfx-docs"
    }
  ],
  "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
  "version": "1.3"
}

From there, it worked:

enter image description here

Answered By: Debro012