# SIEM rule action: Send raw json \`context.alerts\` to webhook

**URL:** <https://discuss.elastic.co/t/siem-rule-action-send-raw-json-context-alerts-to-webhook/290698>\
**Category:** Elastic Security\
**Created:** [December 1, 2021, 5:09pm UTC](https://discuss.elastic.co/t/siem-rule-action-send-raw-json-context-alerts-to-webhook/290698 "2021-12-01T17:09:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![peter6](https://avatars.discourse-cdn.com/v4/letter/p/e5b9ba/32.png) [@peter6](https://discuss.elastic.co/u/peter6)\
**Post date:** [December 1, 2021, 5:09pm UTC](https://discuss.elastic.co/t/siem-rule-action-send-raw-json-context-alerts-to-webhook/290698/1 "2021-12-01T17:09:27Z")

</div>

I'm trying to get the raw json content of `context.alerts` pushed to my webhook for further analysis.

Something like `{{#toJson}}[{{context.alerts}}]{{/toJson}}`

Received content is either empty or escaped `\"`.

Please help.

---

<div class="post-metadata">

**Author:** ![peter6](https://avatars.discourse-cdn.com/v4/letter/p/e5b9ba/32.png) [@peter6](https://discuss.elastic.co/u/peter6)\
**Post date:** [December 3, 2021, 4:09pm UTC](https://discuss.elastic.co/t/siem-rule-action-send-raw-json-context-alerts-to-webhook/290698/2 "2021-12-03T16:09:13Z")

</div>

Never mind. I'm just going to use a watcher.

```auto
PUT _watcher/watch/siem_notifications
{
  "trigger": {
    "schedule": {
      "interval": "5m"
    }
  },
  "input": {
    "search": {
      "request": {
        "indices": [".siem-signals-default-*"],
        "body" : {
          "query" : {
            "range": {
              "@timestamp": {
                "gte": "now-6m"
              }
            }
          }
        }
      }
    }
  },
  "condition": {
    "compare": {
      "ctx.payload.hits.total": {
        "gt": 0
      }
    }
  },
  "actions": {
    "my_bot": {
      "webhook": {
        "url": "https://my-webhook",
        "body": "{{#toJson}}ctx.payload{{/toJson}}"
      }
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 31, 2021, 4:09pm UTC](https://discuss.elastic.co/t/siem-rule-action-send-raw-json-context-alerts-to-webhook/290698/3 "2021-12-31T16:09:24Z")

</div>

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