Add a json in webhook body for teams

alerting

(Sebastian Herrera) #1

Hello guys, i am trying to send alerts to a webhook that i have on my microsoft teams account. for that i need to add this on the webhook body

{
"@context": "http://schema.org/extensions",
"@type": "MessageCard",
"themeColor": "F00",
"title": "Visit the Outlook Dev Portal",
"text": "Click Learn More to learn more about Actionable Messages!"
}

but when i add i am getting error. Any Help?

Regards


(Jymit Singh Khondhu) #2

Please share your elasticsearch.yml and the errors seen?


(Sebastian Herrera) #3

"actions" : {
"sendToTeamsWH" : {
"webhook" : {
"method" : "POST",
"url" : "my url ",
"body": {
"@context": "http://schema.org/extensions",
"@type": "MessageCard",
"themeColor": "F00",
"title": "Visit the Outlook Dev Portal",
"text": "Click Learn More to learn more about Actionable Messages!"
}
}
}

and the error is that @context is not recogniced. Y add all the json in "" but it give me syntax error


(Alexander Reelsen) #4

the body field only allows for a string. This means you need to create the required data structure in a transform in the action and then use the {{#toJson}}ctx.payload.however_you_named_it{{/toJson}} mustache function to automatically convert that datastructure to JSON.

Hope this helps!


(system) #5

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.