posting Incoming webhook to MS Teams using curl command

%3CLINGO-SUB%20id%3D%22lingo-sub-1720968%22%20slang%3D%22en-US%22%3Eposting%20Incoming%20webhook%20to%20MS%20Teams%20using%20curl%20command%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1720968%22%20slang%3D%22en-US%22%3E%3CP%20class%3D%22%22%3Ewe%20are%20using%20azure%20devops%20pipeline%20and%20web%20hook%20notifications%20to%20slack.%3CBR%20%2F%3EFor%20below%20notification%20I%20changed%20the%20webhook%20url%20to%20outlook.%20But%20not%20working%20it%20says%20%3CSTRONG%3E%60Bad%20payload%20received%20by%20generic%20incoming%20webhook%60%3C%2FSTRONG%3E.%20How%20to%20customize%20payload%20for%20teams.%26nbsp%3B%3C%2FP%3E%3CPRE%3Ecurl%20-H%20'Content-Type%3A%20application%2Fjson'%20--data-urlencode%20'payload%3D%7B%22username%22%3A%20%22Application%22%2C%22text%22%3A%20%22Application_IOS_EnterpriseBuild%22%2C%22attachments%22%3A%20%5B%0A%7B%0A%22color%22%3A%20%22%23F35A00%22%2C%0A%22fields%22%3A%20%5B%0A%7B%0A%20%20%20%20%22title%22%3A%20%22Pipeline%22%2C%0A%20%20%20%20%22value%22%3A%20%22'%22%24(Agent.JobName)%22'%22%2C%0A%20%20%20%20%22short%22%3A%20true%0A%7D%0A%5D%0A%7D%2C%0A%7B%0A%22color%22%3A%20%22%23F35A00%22%2C%0A%22fields%22%3A%20%5B%0A%7B%0A%20%20%20%20%22title%22%3A%20%22commit_sha%22%2C%0A%20%20%20%20%22value%22%3A%20%22'%22%24GIT_RELEASE_NOTES%20%22'%22%2C%0A%20%20%20%20%22short%22%3A%20true%0A%7D%0A%5D%0A%7D%2C%0A%7B%0A%22color%22%3A%20%22%23F35A00%22%2C%0A%22fields%22%3A%20%5B%0A%7B%0A%20%20%20%20%22title%22%3A%20%22Status%22%2C%0A%20%20%20%20%22value%22%3A%20%22'%22Started%22'%22%2C%0A%20%20%20%20%22short%22%3A%20true%0A%7D%0A%5D%0A%7D%0A%5D%7D'%20%3CA%20href%3D%22https%3A%2F%2Foutlook.office.com%2Fwebhook%2F6ab53-e6a3-4b3e-ae06-a65cdaf3b31e%2FIncomingWebhook%2Fae2d458317eb4b20a3581fdd01aeecd3%2Fe966e859-4ec9-497a-b1b8-5e6fadb19404(sample)%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Foutlook.office.com%2Fwebhook%2F6ab53-e6a3-4b3e-ae06-a65cdaf3b31e%2FIncomingWebhook%2Fae2d458317eb4b20a3581fdd01aeecd3%2Fe966e859-4ec9-497a-b1b8-5e6fadb19404(sample)%3C%2FA%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1720968%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ETeams%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1741867%22%20slang%3D%22en-US%22%3ERe%3A%20posting%20Incoming%20webhook%20to%20MS%20Teams%20using%20curl%20command%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1741867%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F812047%22%20target%3D%22_blank%22%3E%40moturukalyan%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3ETo%20send%20a%20message%20through%20your%20incoming%20webhook%2C%20you%20post%20a%20JSON%20payload%20to%20the%20webhook%20URL.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EHers%20is%20the%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fmicrosoftteams%2Fplatform%2Fwebhooks-and-connectors%2Fhow-to%2Fconnectors-using%23example-connector-message%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3Eexample%3C%2FA%3E%26nbsp%3B%2C%20you%20can%20get%20more%20information%20regarding%20creating%20incoming%20webhook%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fmicrosoftteams%2Fplatform%2Fwebhooks-and-connectors%2Fhow-to%2Fadd-incoming-webhook%23add-an-incoming-webhook-to-a-teams-channel%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3Ehere%3C%2FA%3E.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
New 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...

 

1 Reply

@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.