# Watcher: Conditional in Actions block?

**URL:** <https://discuss.elastic.co/t/watcher-conditional-in-actions-block/106569>\
**Category:** Elasticsearch\
**Created:** [November 6, 2017, 5:38pm UTC](https://discuss.elastic.co/t/watcher-conditional-in-actions-block/106569 "2017-11-06T17:38:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rozling](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rozling/32/16401_2.png) [@rozling](https://discuss.elastic.co/u/rozling)\
**Post date:** [November 6, 2017, 5:38pm UTC](https://discuss.elastic.co/t/watcher-conditional-in-actions-block/106569/1 "2017-11-06T17:38:58Z")

</div>

I'm sure I've seen this functionality in an example somewhere recently (maybe X-Pack examples?) but I can't seem to find it:

Is it possible to place a simple conditional in the Actions block, something like

```
if(businessHours){"notify-slack": "slack": {
        "message": {
          "to": [
            "#day-channel"
          ],
}
} else if(onCallHours){"notify-slack": "slack": {
        "message": {
          "to": [
            "#on-call-channel"
          ],
}
}

```

And can anyone point me to examples where it's used?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [November 7, 2017, 8:20am UTC](https://discuss.elastic.co/t/watcher-conditional-in-actions-block/106569/2 "2017-11-07T08:20:10Z")

</div>

Hey,

there is an example (the second one on the page) at the action overview page [https://www.elastic.co/guide/en/x-pack/5.6/actions.html](https://www.elastic.co/guide/en/x-pack/5.6/actions.html)

We need to work on docs there and outline this feature better. Sorry for the confusion!

--Alex

---

<div class="post-metadata">

**Author:** ![rozling](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rozling/32/16401_2.png) [@rozling](https://discuss.elastic.co/u/rozling)\
**Post date:** [November 7, 2017, 8:54am UTC](https://discuss.elastic.co/t/watcher-conditional-in-actions-block/106569/3 "2017-11-07T08:54:24Z")

</div>

Ah awesome, thank you! Don't know how I missed that!

---

<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 5, 2017, 8:54am UTC](https://discuss.elastic.co/t/watcher-conditional-in-actions-block/106569/4 "2017-12-05T08:54:52Z")

</div>

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