# Conditional notification with message

**URL:** <https://forum.buildkite.community/t/conditional-notification-with-message/1301>\
**Category:** General\
**Created:** [October 23, 2020, 1:53pm UTC](https://forum.buildkite.community/t/conditional-notification-with-message/1301 "2020-10-23T13:53:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![narwold](https://avatars.discourse-cdn.com/v4/letter/n/9de053/32.png) [@narwold](https://forum.buildkite.community/u/narwold)\
**Post date:** [October 23, 2020, 1:53pm UTC](https://forum.buildkite.community/t/conditional-notification-with-message/1301/1 "2020-10-23T13:53:41Z")

</div>

I’m having trouble with the `notify` option in my BK pipeline. I seem to be able to do this:

```auto
notify:
  - slack: '#my_channel'
    if: build.state == "passed"

```

…or this:

```auto
notify:
  - slack:
      channels:
        - '#my_channel'
      message: 'something bad happened'

```

…but not this (or any other variant like it; BK complains about not knowing what “if” is or not being able to find an expected key or various other errors):

```auto
notify:
  - slack: '#my_channel'
    if: build.state == "passed"
    message: ':white_check_mark: success! :white_check_mark:'

```

Any suggestions?

---

<div class="post-metadata">

**Author:** ![anon17095254](https://avatars.discourse-cdn.com/v4/letter/a/ac91a4/32.png) [@anon17095254](https://forum.buildkite.community/u/anon17095254)\
**Post date:** [October 23, 2020, 5:15pm UTC](https://forum.buildkite.community/t/conditional-notification-with-message/1301/2 "2020-10-23T17:15:27Z")

</div>

Welcome to the community @narwold and thanks for bringing this up. I have reproduced this on my side and am checking with the team whether this is intended behavior. It does seem like we should allow this…

---

<div class="post-metadata">

**Author:** ![narwold](https://avatars.discourse-cdn.com/v4/letter/n/9de053/32.png) [@narwold](https://forum.buildkite.community/u/narwold)\
**Post date:** [October 23, 2020, 6:29pm UTC](https://forum.buildkite.community/t/conditional-notification-with-message/1301/3 "2020-10-23T18:29:22Z")

</div>

Thanks much!

---

<div class="post-metadata">

**Author:** ![anon85971592](https://avatars.discourse-cdn.com/v4/letter/a/dfb087/32.png) [@anon85971592](https://forum.buildkite.community/u/anon85971592)\
**Post date:** [October 27, 2020, 1:27am UTC](https://forum.buildkite.community/t/conditional-notification-with-message/1301/4 "2020-10-27T01:27:18Z")

</div>

Hey @narwold! I think this may work?

```
notify:
  - slack:
      channels: '#my_channel'
      message: ':white_check_mark: success! :white_check_mark:' 
    if: build.state == "passed"
```

---

<div class="post-metadata">

**Author:** ![narwold](https://avatars.discourse-cdn.com/v4/letter/n/9de053/32.png) [@narwold](https://forum.buildkite.community/u/narwold)\
**Post date:** [October 27, 2020, 2:27pm UTC](https://forum.buildkite.community/t/conditional-notification-with-message/1301/5 "2020-10-27T14:27:07Z")

</div>

> [@anon85971592](#):
>
> ```auto
> notify:
> - slack:
> channels: '#my_channel'
> message: ':white_check_mark: success! :white_check_mark:' 
> if: build.state == "passed"
> 
> ```

That worked; thanks!
