Use JSON in Watcher webhook body

How is it possible to use plain JSON in Watcher webhook body?

Just putting the plain JSON in the body

{
    [...]
    "actions":{
       "opsgenie":{
          "webhook":{
             "method":"POST",
             "host":"some.api",
             "path":"/somewhere/",
             "port":443,
             "scheme":"https",
             "headers":{
                "Authorization":"Key XXX",
                "Content-Type":"application/json"
             },
             "body": {
                "message":"Some message",
                "key":"value",
                "some_array":[
                    "string a",
                    "string b"
                ]
             }
          }
       }
    }
 }

results in interpreting fields by Watcher which fails:

[1:653] [script] unknown field [message]

Handling the whole JSON as a string does not work to. How to handle it?

Same problem, but no solution: Watcher webhook body How to build a json format?

Use the {{#toJson}} template function in the body.

See Search templates | Elasticsearch Guide [7.17] | Elastic

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