Forum Discussion

moturukalyan's avatar
moturukalyan
Copper Contributor
Sep 28, 2020

posting Incoming webhook to MS Teams using curl command

we are using azure devops pipeline and web hook notifications to slack.
For below notification I changed the webhook url to outlook. But not working it says `Bad payload received by generic incoming webhook`. How to customize payload for teams. 

curl -H 'Content-Type: application/json' --data-urlencode 'payload={"username": "Application","text": "Application_IOS_EnterpriseBuild","attachments": [
{
"color": "#F35A00",
"fields": [
{
    "title": "Pipeline",
    "value": "'"$(Agent.JobName)"'",
    "short": true
}
]
},
{
"color": "#F35A00",
"fields": [
{
    "title": "commit_sha",
    "value": "'"$GIT_RELEASE_NOTES "'",
    "short": true
}
]
},
{
"color": "#F35A00",
"fields": [
{
    "title": "Status",
    "value": "'"Started"'",
    "short": true
}
]
}
]}' https://outlook.office.com/webhook/6ab53-e6a3-4b3e-ae06-a65cdaf3b31e/IncomingWebhook/ae2d458317eb4b20a3581fdd01aeecd3/e966e859-4ec9-497a-b1b8-5e6fadb19404(sample)

 

2 Replies

  • moturukalyan 

     

    To send a message through your incoming webhook, you post a JSON payload to the webhook URL.

    Hers is the https://docs.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/connectors-using#example-connector-message , you can get more information regarding creating incoming webhook https://docs.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook#add-an-incoming-webhook-to-a-teams-channel.

Resources