MicrosoftDocs / msteams-docs

Source for the Microsoft Teams developer platform documentation.
https://aka.ms/teamsdev
Creative Commons Attribution 4.0 International
284 stars 506 forks source link

Not able to get invokeData from adaptiveCard invoked from Channel #8822

Open Wajeed-msft opened 1 year ago

Wajeed-msft commented 1 year ago

Copied bug from: https://github.com/OfficeDev/TeamsFx/issues/8983

Details from original post: Describe the bug Hi there, I am trying to get data from the adaptive card This works while in DM but it does not work while card is invoked from a Channel

Here is the adaptive card json

{
            "type": "AdaptiveCard",
            "body": [
                {
                    "type": "TextBlock",
                    "text": "Select a team you wish to create an incident",
                    "weight": "Bolder",
                    "size": "Small",
                    "style": "heading",
                    "wrap": true
                },
                {
                    "type": "Input.ChoiceSet",
                    "choices": [{
                         "title": "Red",
                         "value": "red"
                    },{
                         "title": "Green",
                         "value": "green"
                    }],
                    "placeholder": "Select a team",
                    "id": "teamId"
                },
                {
                    "type": "ActionSet",
                    "actions": [
                        {
                            "type": "Action.Execute",
                            "title": "Submit",
                            "verb": "teamForIncident",
                            "fallback": "Action.Submit"
                        }
                    ]
                }

            ],
            "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
            "version": "1.4"
        }

here is the backend code where i am extracting the information

async onAdaptiveCardInvoke(context, invokeValue) {
    // The verb "userlike" is sent from the Adaptive Card defined in adaptiveCards/learn.json
    try {
        const triggeredVerb = invokeValue.action.verb;
        const invokeData = invokeValue.action.data;
        if (invokeData) {
            if (triggeredVerb === "update") {
                const data = helpers.getPriorityAndSeverityFromInvokeData(invokeValue)
                const apiActions = new ApiActions(context.activity);
                const response = await apiActions.priorityAndSeverityUpdate(data);
            }
        }
    } catch (error) {
        console.error(error);
        Honeybadger.notify(error);
    }
}

To Reproduce Steps to reproduce the behavior:

  1. Send the adaptive card to a Channel.
  2. hit submit.
  3. teamId is not recieved

Expected behavior On hitting submit i should recieve teamid in the data

Screenshots n/a

Additional context I am using Teams toolkit v4.4 adaptive card version 1.4

Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

ghost commented 1 year ago

Hi Wajeed-msft! 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

Nivedipa-MSFT commented 1 year ago

@data-pirate - We have tested this and at our end we are getting teams id. We have tested this using below sample: https://github.com/OfficeDev/TeamsFx-Samples/tree/381f4da0fc68869e41a5546481b56bc294ecd9ea/hello-world-bot-with-tab

image

Could you please test this and confirm on this?

data-pirate commented 1 year ago

Hi there @Nivedipa-MSFT

There seems to be a miscommunication in understanding my problem. I don't want the Microsoft teams Channel/teamId. What I want to achieve is I want to send an adaptive card with a choiceSet and the choices can be anything. I want to get the value that the user selected. The logic and the adaptive card that I have pasted above work as expected when the adaptive card is invoked in a DM. But when this adaptive card is sent to a channel let's say General channel. I receive nothing on the backend.

Nivedipa-MSFT commented 1 year ago

@data-pirate - We have tested this using below sample: https://github.com/OfficeDev/TeamsFx-Samples/tree/381f4da0fc68869e41a5546481b56bc294ecd9ea/hello-world-bot-with-tab

Send the below adaptive card.

{
            "type": "AdaptiveCard",
            "body": [
                {
                    "type": "TextBlock",
                    "text": "Select a team you wish to create an incident",
                    "weight": "Bolder",
                    "size": "Small",
                    "style": "heading",
                    "wrap": true
                },
                {
                    "type": "Input.ChoiceSet",
                    "choices": [{
                         "title": "Red",
                         "value": "red"
                    },{
                         "title": "Green",
                         "value": "green"
                    }],
                    "placeholder": "Select a team",
                    "id": "teamId"
                },
                {
                    "type": "ActionSet",
                    "actions": [
                        {
                            "type": "Action.Execute",
                            "title": "Submit",
                            "verb": "teamForIncident",
                            "fallback": "Action.Submit"
                        }
                    ]
                }

            ],
            "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
            "version": "1.4"
        }

In personal chat we are getting teamId value which we selected and in channel we are getting undefined value.

Personal chat: image

Channel in Teams: image

image

We have raised a bug for the same. We will let you know once we get any updates on it.

Keviento commented 1 year ago

We have a similar issue, received data is null with Action.Execute from a channel with C# backend. As a workaround we used Action.Submit and added a verb in the data to keep a somewhat similar flow.

ktkaushik commented 1 year ago

@Nivedipa-MSFT any luck with this? we would really like to go ahead and release our teams app. This has been a large blocker.

Nivedipa-MSFT commented 1 year ago

@ktkaushik - Currently, we do not have any ETA to share. However, we want to assure you that the engineering team is actively working on resolving the bug. We understand the importance of this issue and its impact on your experience. Rest assured that we will keep you informed and provide updates as soon as we have more information. Thank you for your patience and understanding.

ktkaushik commented 1 year ago

@Nivedipa-MSFT in that case, do we go forward with action.submit then? we know it's getting deprecated but would you recommend we use that in the mean time in production?

data-pirate commented 1 year ago

Hi there, @Nivedipa-MSFT Any update on this issue? This has been a large blocker for the past 1 month.

Nivedipa-MSFT commented 1 year ago

@data-pirate - Currently, we don't have any ETA to share. Engineering team is actively working on the fix. We will let you know once we get any updates on it.