Adaptive Card appears as blank on MS Teams iOS app

30 Views Asked by At

I am trying to post Adaptive Card to MS Teams channel using python script. The message is rendered correctly on desktop app but nothing is displayed on iOS app. iOS app build is 6.5.77.2024052102/0311 (general)/Release branch 2024Mar-T1.

Desktop App Image

iOS App Image

Here's my code snippet.

import json
import requests

TEAMS_MESSAGE = {
   "type":"message",
   "attachments":[
        {
            "contentType":"application/vnd.microsoft.card.adaptive",
            "content":{
                "type":"AdaptiveCard",
                "body":[
                    {
                        "type": "TextBlock",
                        "text": "<at>John Doe</at>\n\nTest message.\n\n[Test hyperlink](https://www.example.com/)"
                    }
                ],
                "wrap": "true",
                "$schema":"http://adaptivecards.io/schemas/adaptive-card.json",
                "version":"1.5",
                "msteams": {
                    "entities": [
                        {
                            "type": "mention",
                            "text": "<at>John Doe</at>",
                            "mentioned": {
                                "id": "[email protected]",
                                "name": "John Doe"
                            }
                        }
                    ]
                }
            }
        }
    ]
}

WEBHOOK_URL = "https://contoso.webhook.office.com/webhookb2/xxxxx"
requests.post(WEBHOOK_URL, json.dumps(TEAMS_MESSAGE))

Any advice would be really appreciated. Thanks in advance.

0

There are 0 best solutions below