OfficeDev / microsoft-teams-library-js

JavaScript library for use by Microsoft Teams apps
https://docs.microsoft.com/microsoftteams/platform/
Other
421 stars 192 forks source link

MS Teams is failing to refresh card content that previously failed to process via "adaptiveCard/action" event #1888

Open miron4dev opened 11 months ago

miron4dev commented 11 months ago

Following this guide, I want to display different card contents for senders and receivers.

In a composeExtension/queryLink callback, I return an adaptive card with the following refresh block:

{
    "refresh": {
        "action": {
            "type": "Action.Execute",
            "title": "Submit",
            "data": {
                "someData": "someValue"
            }
        },
        "userIds": [senderId]
    }
 }

✅ As it is specified in the current documentation, MS Teams makes an "adaptiveCard/action" request on behalf of a user with senderId user id. ✅ If my bot responds with a valid JSON, MS Teams updates the card for the sender. ✅ If my bot doesn't respond or responds with a failure, MS Teams doesn't update the card and show the "Something went wrong. Please try again".

Screenshot 2023-08-21 at 19 36 39

🚫 When I click the refresh button, MS Teams no longer requests the bot, and nothing happens. Users can not update the card anyhow but only recreate it.

Expected behavior: When I click the refresh button, MS Team tries to refresh the card again by making an additional "adaptiveCard/action" request to the bot.

A sample project to reproduce the issue: https://github.com/miron4dev/ms-teams-universal-action-model-refresh-issue

microsoft-github-policy-service[bot] commented 11 months ago

Hi miron4dev! Thank you for bringing this issue to our attention. We will investigate and if we require further information we will reach out in one business day. Please use this link to escalate if you don't get replies.

Best regards, Teams Platform

nwojod-MSFT commented 11 months ago

Hello @miron4dev thank you for reporting this issue. To help us investigate, can you please share what version of teams-js you are using and on what platform you are experiencing this issue.

Prasad-MSFT commented 11 months ago

Hi @miron4dev - We tried with the sample code provided (https://github.com/miron4dev/ms-teams-universal-action-model-refresh-issue/tree/main) in MS Teams desktop (Microsoft Teams Version 1.6.00.22577) and web client and are able to repro this issue. teams-js/2.8.0 image

{
    "composeExtension": {
        "type": "result",
        "attachmentLayout": "list",
        "attachments": [
            {
                "contentType": "application/vnd.microsoft.card.adaptive",
                "content": {
                    "type": "AdaptiveCard",
                    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
                    "version": "1.5",
                    "height": "auto",
                    "body": [
                        {
                            "type": "TextBlock",
                            "size": "extraLarge",
                            "text": "Adaptive Card",
                            "height": "auto"
                        },
                        {
                            "type": "Image",
                            "url": "https://raw.githubusercontent.com/microsoft/botframework-sdk/master/icon.png",
                            "height": "auto"
                        }
                    ],
                    "refresh": {
                        "action": {
                            "type": "Action.Execute",
                            "title": "Submit",
                            "data": {
                                "someData": "someValue"
                            }
                        },
                        "userIds": [
                            "29:1PBlnIsEROUYzpFjULDVodMHrnpujmfhBdQAf0pcO1EkaDkhI0_Pj_ql-jZUYOGdSc3_KcqaIIjzbleraVJ2Z3g"
                        ]
                    },
                    "actions": []
                },
                "preview": {
                    "contentType": "application/vnd.microsoft.card.adaptive",
                    "content": {
                        "type": "AdaptiveCard",
                        "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
                        "version": "1.5",
                        "height": "auto",
                        "body": [
                            {
                                "type": "TextBlock",
                                "size": "extraLarge",
                                "text": "Adaptive Card",
                                "height": "auto"
                            },
                            {
                                "type": "Image",
                                "url": "https://raw.githubusercontent.com/microsoft/botframework-sdk/master/icon.png",
                                "height": "auto"
                            }
                        ],
                        "refresh": {
                            "action": {
                                "type": "Action.Execute",
                                "title": "Submit",
                                "data": {
                                    "someData": "someValue"
                                }
                            },
                            "userIds": [
                                "29:1PBlnIsEROUYzpFjULDVodMHrnpujmfhBdQAf0pcO1EkaDkhI0_Pj_ql-jZUYOGdSc3_KcqaIIjzbleraVJ2Z3g"
                            ]
                        },
                        "actions": []
                    }
                }
            }
        ],
        "suggestedActions": {
            "actions": [
                {
                    "type": "setCachePolicy",
                    "value": {
                        "type": "no-cache"
                    }
                }
            ]
        }
    }
}

We have raised a bug for the same. We will inform you once we get any further update from engineering team. Thanks!

miron4dev commented 3 weeks ago

Hi @Prasad-MSFT

Do you have any updates?