Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
syedjalal12 opened this issue Nov 19, 2021 · 4 comments
Assignees
Labels
Bot Services equired for internal Azure reporting. Do not delete. Do not change color. customer-reported Required for internal Azure reporting. Do not delete. ExemptFromDailyDRIReport Support Requesting assistance from the Support Team

Comments

@syedjalal12
Copy link

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 )      `

Then I 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 understand where. So can anyone please help me out here?

@syedjalal12
Copy link
Author

This how the adaptive card appears:
Bot Framework Emulator 19_11_2021 2_28_18 pm

And this is how it should be:
QuickAdaptiveJSONfile json - Python Behave BDD - Visual Studio Code 19_11_2021 2_30_12 pm

@syedjalal12 syedjalal12 changed the title I cant see my adaptive card on the emulator. it appears as blank. I cant see my adaptive card on the Bot builder emulator, it appears as blank. Nov 19, 2021
@dmvtech dmvtech transferred this issue from microsoft/BotFramework-Services Nov 19, 2021
@dmvtech dmvtech added Bot Services equired for internal Azure reporting. Do not delete. Do not change color. customer-reported Required for internal Azure reporting. Do not delete. Support Requesting assistance from the Support Team labels Nov 19, 2021
@syedjalal12
Copy link
Author

syedjalal12 commented Nov 24, 2021

This is my generated Adaptive card JSOn file

{ "type": "AdaptiveCard", "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", "version": "1.5", "body": [ { "type": "Container", "items": [ { "type": "TextBlock", "text": "Departing DETAILS", "wrap": true, "color": "Accent", "weight": "Bolder", "size": "Large", "horizontalAlignment": "Center" } ] }, { "type": "Container", "items": [ { "type": "ColumnSet", "columns": [ { "type": "Column", "width": "stretch", "items": [ { "type": "TextBlock", "text": "Doha", "wrap": true, "color": "Good", "size": "Medium", "weight": "Bolder", "fontType": "Monospace", "horizontalAlignment": "Left" } ], "verticalContentAlignment": "Center", "id": "DepartingFlightDepartingCity" }, { "type": "Column", "width": "50px", "items": [ { "type": "Image", "url": "FlightPlane.png", "size": "Small", "horizontalAlignment": "Center", "id": "DepartingPlaneImg" } ] }, { "type": "Column", "width": "stretch", "items": [ { "type": "TextBlock", "wrap": true, "text": "Barcelona", "fontType": "Monospace", "weight": "Bolder", "color": "Good", "size": "Medium", "horizontalAlignment": "Right" } ], "id": "DepartingFlightArrivalCity", "verticalContentAlignment": "Center" } ] } ], "id": "DepartingFlightCities", "isVisible": true }, { "type": "Container", "items": [ { "type": "ColumnSet", "columns": [ { "type": "Column", "width": "stretch", "items": [ { "type": "TextBlock", "text": "Departing Airport: Hamad International Airport", "wrap": true, "fontType": "Monospace", "size": "Small", "weight": "Bolder", "color": "Light" } ], "id": "DepartingFlightDepartingAirport" }, { "type": "Column", "width": "stretch", "items": [ { "type": "TextBlock", "text": "Arrival Airport: Josep Tarradellas Barcelona-El Prat Airport", "wrap": true, "fontType": "Monospace", "size": "Small", "weight": "Bolder", "color": "Light", "horizontalAlignment": "Right" } ], "id": "DepartingFlightArrivalAirport" } ] } ], "verticalContentAlignment": "Center", "id": "DepartingAirports", "isVisible": true }, { "type": "Container", "items": [ { "type": "ColumnSet", "columns": [ { "type": "Column", "width": "stretch", "items": [ { "type": "TextBlock", "text": "Take off: 7:45 AM", "wrap": true, "weight": "Bolder", "color": "Accent", "fontType": "Monospace" } ], "id": "DepartingFlightDepartingTime" }, { "type": "Column", "width": "stretch", "items": [ { "type": "TextBlock", "text": "Landing: 12:50 PM", "wrap": true, "horizontalAlignment": "Right", "style": "default", "weight": "Bolder", "color": "Accent", "fontType": "Monospace" } ], "id": "DepartingFlightArrivalTime" } ] } ], "id": "DepartingFlightTime", "isVisible": true }, { "type": "Container", "items": [ { "type": "TextBlock", "wrap": true, "text": "Total flight time: 7 hr 5 min.", "horizontalAlignment": "Center", "fontType": "Monospace", "size": "Medium", "weight": "Bolder" } ], "id": "DepartingFlightTotalTime", "isVisible": true }, { "type": "Container", "items": [ { "type": "TextBlock", "wrap": true, "text": "Total layovers: 5000", "size": "Medium", "fontType": "Monospace", "weight": "Bolder", "id": "TotalLayovers" }, { "type": "Container", "items": [ { "type": "ColumnSet", "columns": [ { "type": "Column", "width": "auto", "items": [ { "type": "Image", "url": "https://static.thenounproject.com/png/3184838-200.png", "size": "Medium", "id": "LayoverImg" } ], "verticalContentAlignment": "Top" }, { "type": "Column", "width": "stretch", "items": [ { "type": "TextBlock", "text": "Layover city: L A Y RETURN C I T Y ", "wrap": true, "fontType": "Monospace", "size": "Default", "weight": "Bolder", "id": "LayoverCity" }, { "type": "TextBlock", "text": "Layover airport: L A Y RETURN A I R P O R T", "fontType": "Monospace", "weight": "Bolder", "wrap": true, "id": "LayoverAirport" }, { "type": "TextBlock", "text": "Layover time: L A Y RETURN T I M E", "wrap": true, "fontType": "Monospace", "weight": "Bolder", "id": "LayoverTime" } ] } ] } ], "style": "attention", "id": "LayoverDetails" } ], "style": "warning", "id": "DepartingLayoverContainer", "isVisible": false }, { "type": "Container", "items": [ { "type": "TextBlock", "wrap": true, "text": "RETURN DETAILS", "horizontalAlignment": "Center", "size": "Large", "color": "Accent", "weight": "Bolder" } ] }, { "type": "Container", "items": [ { "type": "ColumnSet", "columns": [ { "type": "Column", "width": "stretch", "items": [ { "type": "TextBlock", "text": "Barcelona", "wrap": true, "fontType": "Monospace", "size": "Medium", "weight": "Bolder", "color": "Good" } ], "verticalContentAlignment": "Center", "id": "ReturnFlightDepartingCity" }, { "type": "Column", "width": "50px", "items": [ { "type": "Image", "url": "FlightPlane.png", "horizontalAlignment": "Center", "size": "Small", "width": "-1px" } ] }, { "type": "Column", "width": "stretch", "items": [ { "type": "TextBlock", "wrap": true, "text": "Doha", "horizontalAlignment": "Right", "fontType": "Monospace", "size": "Medium", "weight": "Bolder", "color": "Good" } ], "verticalContentAlignment": "Center", "id": "ReturnFlightArrivalCity" } ] } ], "id": "ReturnFlightCities", "isVisible": true }, { "type": "Container", "items": [ { "type": "ColumnSet", "columns": [ { "type": "Column", "width": "stretch", "items": [ { "type": "TextBlock", "text": "Departing Airport: Josep Tarradellas Barcelona-El Prat Airport", "wrap": true, "fontType": "Monospace", "size": "Small", "weight": "Bolder", "color": "Light" } ], "id": "ReturnFlightDepartingAirport" }, { "type": "Column", "width": "stretch", "items": [ { "type": "TextBlock", "text": "Arrival Airport: Hamad International Airport", "wrap": true, "horizontalAlignment": "Right", "fontType": "Monospace", "size": "Small", "weight": "Bolder", "color": "Light" } ], "id": "ReturnFlightArrivalAirport" } ] } ], "id": "ReturnAirports", "isVisible": true }, { "type": "Container", "items": [ { "type": "ColumnSet", "columns": [ { "type": "Column", "width": "stretch", "items": [ { "type": "TextBlock", "text": "Take off: 8:40 AM", "wrap": true, "fontType": "Monospace", "weight": "Bolder", "color": "Accent" } ], "id": "ReturnFlightDepartingTime" }, { "type": "Column", "width": "stretch", "items": [ { "type": "TextBlock", "text": "Landing: 4:55 PM", "wrap": true, "horizontalAlignment": "Right", "fontType": "Monospace", "weight": "Bolder", "color": "Accent" } ], "id": "ReturnFlightArrivalTime" } ] } ], "id": "ReturnFlightTime", "isVisible": true }, { "type": "Container", "items": [ { "type": "TextBlock", "text": "Total flight time: 6 hr 15 min.", "wrap": true, "weight": "Bolder", "fontType": "Monospace", "size": "Medium", "horizontalAlignment": "Center" } ], "id": "ReturnFlightTotalTime", "isVisible": true }, { "type": "Container", "items": [ { "type": "TextBlock", "wrap": true, "text": "Total layovers: 5000", "size": "Medium", "fontType": "Monospace", "weight": "Bolder", "id": "TotalLayovers" }, { "type": "Container", "items": [ { "type": "ColumnSet", "columns": [ { "type": "Column", "width": "auto", "items": [ { "type": "Image", "url": "https://static.thenounproject.com/png/3184838-200.png", "size": "Medium", "id": "LayoverImg" } ], "verticalContentAlignment": "Top" }, { "type": "Column", "width": "stretch", "items": [ { "type": "TextBlock", "text": "Layover city: L A Y RETURN C I T Y ", "wrap": true, "fontType": "Monospace", "size": "Default", "weight": "Bolder", "id": "LayoverCity" }, { "type": "TextBlock", "text": "Layover airport: L A Y RETURN A I R P O R T", "fontType": "Monospace", "weight": "Bolder", "wrap": true, "id": "LayoverAirport" }, { "type": "TextBlock", "text": "Layover time: L A Y RETURN T I M E", "wrap": true, "fontType": "Monospace", "weight": "Bolder", "id": "LayoverTime" } ] } ] } ], "style": "attention", "id": "LayoverDetails" } ], "style": "warning", "id": "ContainerReturnLayover", "isVisible": false }, { "type": "Container", "items": [ { "type": "Container", "items": [ { "type": "ColumnSet", "columns": [ { "type": "Column", "width": "auto", "items": [ { "type": "TextBlock", "wrap": true, "text": "TOTAL FARE:", "fontType": "Monospace", "size": "Large", "color": "Accent", "style": "heading" } ], "verticalContentAlignment": "Center" }, { "type": "Column", "width": "stretch", "items": [ { "type": "TextBlock", "text": "PKR 192,037", "wrap": true, "style": "heading", "fontType": "Monospace", "size": "ExtraLarge", "color": "Good", "horizontalAlignment": "Right" } ], "id": "CostOfFlight" } ] } ] } ], "id": "TotalFlightCost", "isVisible": true }, { "type": "Container", "items": [ { "type": "ActionSet", "actions": [ { "type": "Action.OpenUrl", "style": "positive", "title": "VIEW DETAILS", "url": "https://www.google.com/travel/flights/booking?tfs=CBwQAhpJagwIAxIIL20vMGYyeXcSCjIwMjEtMTItMDlyDAgDEggvbS8wMWY2MiIfCgNET0gSCjIwMjEtMTItMDkaA0JDTioCUVIyAzE0NRpJagwIAxIIL20vMDFmNjISCjIwMjEtMTItMTNyDAgDEggvbS8wZjJ5dyIfCgNCQ04SCjIwMjEtMTItMTMaA0RPSCoCUVIyAzEzOHABggELCP___________wFAAUgBmAEB&tfu=CmxDalJJYjNCT2FHbEtPVGxOYWxsQlRGRnVjV2RDUnkwdExTMHRMUzB0TFhkeloyZ3hNRUZCUVVGQlIwZGpNMEp2UWpSVU1FRkJFZ1ZSVWpFek9Cb0xDS2JjQ3hBQUdnTlFTMUk0SEhEMjFBWT0SBggFEAAYAA" } ] } ], "id": "FlightURL", "isVisible": true } ] }

@rvinothrajendran
Copy link

Issue in the json file , fix this issue and check again

image

@syedjalal12
Copy link
Author

Issue resolver.
Thank you @rvinothrajendran

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bot Services equired for internal Azure reporting. Do not delete. Do not change color. customer-reported Required for internal Azure reporting. Do not delete. ExemptFromDailyDRIReport Support Requesting assistance from the Support Team
Projects
None yet
Development

No branches or pull requests

5 participants