Msteams-docs: Post a message to the webhook using cURL

Created on 14 Apr 2020  Â·  6Comments  Â·  Source: MicrosoftDocs/msteams-docs

The example given there does not work.

curl -H 'Content-Type: application/json' -d '{\"text\": \"Hello World\"}' <YOUR WEBHOOK URL>

It should be update to something like this:

curl -H 'Content-Type: application/json' -d '{"@context": "http://schema.org/extensions","@type": "MessageCard", "text": "Hello World"}' <YOUR WEBHOOK URL>

Document Details

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

doc-enhancement

Most helpful comment

This fixes the issue: https://github.com/MicrosoftDocs/msteams-docs/issues/1649

In this documentation: https://docs.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/connectors-using#post-a-message-to-the-webhook-using-curl

// on macOS or Linux
curl -H 'Content-Type: application/json' -d '{\"text\": \"Hello World\"}' <YOUR WEBHOOK URL>

This returns:
Bad payload received by generic incoming webhook.

The correct command is:
curl -H 'Content-Type: application/json' -d '{"text": "Hello World"}' <YOUR WEBHOOK URL>
without the backslashes \

This returns:
1

All 6 comments

Hi camil-o! Thank you for bringing this issue to our attention. We will investigate and if we require further information we will reach out. Best regards, Teams Platform

Same issues observed by trying out ths example.

Try formatting the json without the slashes and it works! I have also put the payload with -d at the end.

Please feel free to reopen if you have further query

The documentation needs to be changed to remove the escaping slashes from the payload.

This fixes the issue: https://github.com/MicrosoftDocs/msteams-docs/issues/1649

In this documentation: https://docs.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/connectors-using#post-a-message-to-the-webhook-using-curl

// on macOS or Linux
curl -H 'Content-Type: application/json' -d '{\"text\": \"Hello World\"}' <YOUR WEBHOOK URL>

This returns:
Bad payload received by generic incoming webhook.

The correct command is:
curl -H 'Content-Type: application/json' -d '{"text": "Hello World"}' <YOUR WEBHOOK URL>
without the backslashes \

This returns:
1

Was this page helpful?
0 / 5 - 0 ratings

Related issues

luismanez picture luismanez  Â·  5Comments

krishnajaju picture krishnajaju  Â·  6Comments

KyleSchroeder picture KyleSchroeder  Â·  5Comments

paulconlin picture paulconlin  Â·  5Comments

bezua picture bezua  Â·  7Comments