Forum Discussion

miguelc21's avatar
miguelc21
Icon for Microsoft rankMicrosoft
Jul 07, 2024

AdaptiveCard not working with incoming webhook

Anyone have any idea why webhook endpoint would be returning the following error? It seems I already have the type set and still get this error in the response with card actually being posted in teams. Seems to work fine with MessageCard though.

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

Here is an example payload that still fails for me with same error message.

const 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, payload)
        .then(function (response) {
            console.log(response);
        })
        .catch(function (error) {
            console.log(error);
        });



Resources