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

Incoming Webhook not working with AdaptiveCard #11222

Open
miguelc1221 opened this issue Jul 8, 2024 · 8 comments
Open

Incoming Webhook not working with AdaptiveCard #11222

miguelc1221 opened this issue Jul 8, 2024 · 8 comments
Assignees
Labels
teams-developer-support Question related to extensibility (Bot, ME, Tab) would be marked under this label

Comments

@miguelc1221
Copy link

Steps to reproduce

Hi, not sure if this is a bug but incoming webhook is not working with adaptivecard (It works fine with MessageCard). I created an incoming webhook using the connector (I know it will be deprecated soon). Instead it is returning "AdaptiveCards.AdaptiveSerializationException: Property 'type' must be 'AdaptiveCard'" . Here is what my request looks like

    const formatted_Card_Payload = {
        type: 'message',
        attachments: [
            {
                contentType: 'application/vnd.microsoft.card.adaptive',
                contentUrl: null,
                content: {
                    $schema:
                        'http://adaptivecards.io/schemas/adaptive-card.json',
                    type: 'AdaptiveCard',
                    version: '1.6',
                    body: [
                        {
                            type: 'TextBlock',
                            text: 'Submitted response',
                        },
                    ],
                },
            },
        ],
    };

    axios
        .post(options.webhookUrl, formatted_Card_Payload, {
            headers: { 'content-type': 'application/json' },
        })
        .then(function (response) {
            console.log(response);
        })
        .catch(function (error) {
            console.log(error);
        });

Expected behavior

Should send an AdaptiveCard to channel

Actual behavior

It's not sending an AdaptiveCard and instead returning an error message.

Error details

"AdaptiveCards.AdaptiveSerializationException: Property 'type' must be 'AdaptiveCard'"

@Prasad-MSFT Prasad-MSFT self-assigned this Jul 8, 2024
@Prasad-MSFT Prasad-MSFT added teams-developer-support Question related to extensibility (Bot, ME, Tab) would be marked under this label and removed needs-triage 🔍 labels Jul 8, 2024
@Prasad-MSFT
Copy link
Collaborator

Hi @miguelc1221 - Could you please try sending the same JSON using POSTMAN or cURL and verify if that works or not? We tried sending the below JSON using POSTMAN and it worked fine.
image

{
       "type":"message",
       "attachments":[
          {
             "contentType":"application/vnd.microsoft.card.adaptive",
             "contentUrl":null,
             "content":{
                "$schema":"http://adaptivecards.io/schemas/adaptive-card.json",
                "type":"AdaptiveCard",
                "version":"1.2",
                "body":[
                    {
                    "type": "TextBlock",
                    "text": "Submitted response"
                    }
                ]
             }
          }
       ]
    }

@miguelc1221
Copy link
Author

@Prasad-MSFT Hey, I get the same error when using postman, only MessageCards work. I followed these docs to create a webhook https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook?tabs=newteams%2Cdotnet. Any idea if it's possible my org has any settings not allowing this? The error message doesn't make sense if that is the case.

@Prasad-MSFT
Copy link
Collaborator

@miguelc1221 - This is quite strange as this works perfectly fine at our end. Also, could you please let us know if this issue is specific to this particular card JSON or is it happening with any card JSON?

@miguelc1221
Copy link
Author

@Prasad-MSFT It happens with any AdaptiveCard Json, only works with MessageCards

@hachi1030-Allen
Copy link

Hi @Prasad-MSFT

I encountered the same issue here.

When using Adaptive Card json, it shows that the type must be AdaptiveCard, and I changed it from "messaage" to "AdaptiveCard", and it will pop up error like there must be Summary or Text, things like that.

I was using a python script to send this post request to my incoming webhook, and it also reproduce with the REST API tools like Postman, etc.

I have changed to MessageCards but I got this warning all the time.

image

Thanks!

@Prasad-MSFT
Copy link
Collaborator

@hachi1030-Allen , this entire feature is being removed in July-August 2024.
See: https://devblogs.microsoft.com/microsoft365dev/retirement-of-office-365-connectors-within-microsoft-teams

@hachi1030-Allen
Copy link

Hi @Prasad-MSFT , so you meant that the incoming webhook will be removed totally from Teams connector is that correct?

Thanks,
Allen

@Prasad-MSFT
Copy link
Collaborator

None of connector will work after 1st of October. You can still use current connectors until that date. Until 15th of August there is possibility to create new connectors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
teams-developer-support Question related to extensibility (Bot, ME, Tab) would be marked under this label
Projects
None yet
Development

No branches or pull requests

3 participants