Watcher webhook custom json

Hay all

I am trying to get my head around customise the body of an webhook so instead of just ctx i like to out put for example

{
"name":"ctx.name",
"date trigger":"ctx.date",
"event level": "ctx.evlevel"
}

thanks in advance

Hey,

the correct way would be to create that object (as a hashmap) in a script via a transform and then use "body":"{{#toJson}}ctx.my_object{{/toJson}}" in the watch action.

See https://www.elastic.co/guide/en/elastic-stack-overview/6.6/actions-webhook.html and https://www.elastic.co/guide/en/elasticsearch/reference/6.6/search-template.html

hope this helps!

--Alex

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