posting Incoming webhook to MS Teams using curl command

Copper Contributor

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/ae2d458317eb4b2...

 

2 Replies

@moturukalyan 

 

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

Hers is the example , you can get more information regarding creating incoming webhook here.

@Varaprasad-MSFT 

 

Were you able to achieve this issue ? We are unable to do, we are hitting "Bad payload Received by Generic incoming Webhook." Can you please share the sample full curl command with attachment payload. We are struggling to get this addressed - https://techcommunity.microsoft.com/t5/microsoft-teams/migrating-the-scripts-to-ms-teams/m-p/2620143...