How to pass body to endPoint using a watcher

Hi,

I'm trying to call a public endpoint (p-log.herokuapp.com), sending the json-body in the request, using a sentinl watcher
The service p-log.herokuapp.com show me the request with headers but the body is always empty. Why???
Here below the code of my watcher:

   {
  "actions": {
    "call_external_endPoint": {
      "webhook": {
        "method": "POST",
        "host": "p-log.herokuapp.com",
        "port": 80,
        "path": "/endpoint/",
        "params": {},
        "body": "{{#toJson}}ctx.payload{{/toJson}}",
        "headers": {
          "Content-type": "application/json"
        }
      }
    }
  },
  "input": {
    "search": {
      "request": {
        "index": [
          "logstash*"
        ],
        "body": {
          "size": 0,
          "query": {
            "bool": {
              "must": [
                {
                  "match": {
                    "fields.EnvironmentName": "Production"
                  }
                },
                {
                  "range": {
                    "@timestamp": {
                      "gte": "now-10d/d",
                      "lt": "now/d"
                    }
                  }
                }
              ]
            }
          },
          "aggs": {
            "Applications": {
              "terms": {
                "field": "fields.ApplicationName.raw"
              },
              "aggs": {
                "Level": {
                  "terms": {
                    "field": "level.raw"
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "condition": {
    "script": {
      "script": "payload.hits.total > 0"
    }
  },
  "trigger": {
    "schedule": {
      "later": "every 24 hours"
    }
  },
  "title": "TEST - Call External EndPoint",     
}

Could someone help me?
Thanks.

The script condition never matches, thus the watch is never executed, as you need to use ctx.payload.hits.total.

oh, I just realized you are not talking about the alerting feature. You might have more success in the forums of the specific product, instead of asking here. Sorry for the confusion.

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