Reputation: 313
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?
Upvotes: 1
Views: 892
Reputation: 119
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:
Upvotes: 0