Search code examples
pythonbotframeworkbotschatbotadaptive-cards

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


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

Solution

  • look like issue in the json file.

    enter image description here