I created an ELK Watcher with this action in my Watch JSON
to send a message to a Teams channel:
"msteams_webhook": {
"webhook": {
"scheme": "https",
"host": "my.host.com",
"port": 443,
"method": "post",
"path": "/webhookb2/path",
"params": {},
"headers": {
"Content-Type": "application/json"
},
"body": {
"text": "Found the following 4XX or 5XX errors in logs"
}
}
}
When I execute it I get a 400 error with this message in the response body:
Bad payload received by generic incoming webhook.
I think the issue is with the structure of my JSON
body but I'm not sure. Can anybody spot the issue here?
I ended up doing:
"msteams_webhook": {
"throttle_period_in_millis": 60000,
"webhook": {
"scheme": "https",
"host": "my.host.com",
"port": 443,
"method": "post",
"path": "/webhookb2/path",
"params": {},
"headers": {
"Content-Type": "application/json"
},
"body": """{
"type":"message",
"attachments":[
{
"contentType":"application/vnd.microsoft.card.adaptive",
"contentUrl":null,
"content":{
"$schema":"http://adaptivecards.io/schemas/adaptive-card.json",
"type":"AdaptiveCard",
"version":"1.2",
"body":[
{
"type": "TextBlock",
"text": "Found the following 4XX or 5XX errors in logs"
}
],
"msteams": {
"width": "Full"
}
}
}
]
}"""
}
}