# Condition not taken into consideration on slack notifications config

**URL:** <https://travis-ci.community/t/condition-not-taken-into-consideration-on-slack-notifications-config/7800>\
**Category:** Travis CI Discussions & Feedback\
**Tags:** notifications\
**Created:** [March 25, 2020, 8:30pm UTC](https://travis-ci.community/t/condition-not-taken-into-consideration-on-slack-notifications-config/7800 "2020-03-25T20:30:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![yassermouahid](https://avatars.discourse-cdn.com/v4/letter/y/90ced4/32.png) [@yassermouahid](https://travis-ci.community/u/yassermouahid)\
**Post date:** [March 25, 2020, 8:30pm UTC](https://travis-ci.community/t/condition-not-taken-into-consideration-on-slack-notifications-config/7800/1 "2020-03-25T20:30:06Z")

</div>

Hello all, i added this condition to my travis.yml, the alert display on slack channel on all branches and not only on master branch

```auto
 slack:
 if: branch = master
   rooms:
     - <account>:<token>

```

---

<div class="post-metadata">

**Author:** ![BanzaiMan](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/banzaiman/32/67_2.png) [@BanzaiMan](https://travis-ci.community/u/BanzaiMan)\
**Post date:** [March 25, 2020, 9:39pm UTC](https://travis-ci.community/t/condition-not-taken-into-consideration-on-slack-notifications-config/7800/2 "2020-03-25T21:39:10Z")

</div>

If this is the exact formatting of your configuration, I would point out that `if` is on the same level as `slack`. Please review

> **[Travis CI Documentation](https://docs.travis-ci.com/user/notifications/#conditional-notifications)**
>
> Configuring Build Notifications

  
which tells you that `if` is one level below `slack`.

---

<div class="post-metadata">

**Author:** ![yassermouahid](https://avatars.discourse-cdn.com/v4/letter/y/90ced4/32.png) [@yassermouahid](https://travis-ci.community/u/yassermouahid)\
**Post date:** [March 25, 2020, 10:07pm UTC](https://travis-ci.community/t/condition-not-taken-into-consideration-on-slack-notifications-config/7800/4 "2020-03-25T22:07:20Z")

</div>

Thanks @BanzaiMan, I updated the code and it still doesn’t work

```
  slack:
    if: branch = "master"
    rooms:
      - abct:q6IX9D3F8cd
```

---

<div class="post-metadata">

**Author:** ![dchaur](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/dchaur/32/5013_2.png) [@dchaur](https://travis-ci.community/u/dchaur)\
**Post date:** [August 5, 2020, 9:05am UTC](https://travis-ci.community/t/condition-not-taken-into-consideration-on-slack-notifications-config/7800/5 "2020-08-05T09:05:35Z")

</div>

Same problem here, not sure why the documentation is not aligned… if you found out the solution let me know  
thanks

---

<div class="post-metadata">

**Author:** ![BanzaiMan](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/banzaiman/32/67_2.png) [@BanzaiMan](https://travis-ci.community/u/BanzaiMan)\
**Post date:** [August 5, 2020, 2:51pm UTC](https://travis-ci.community/t/condition-not-taken-into-consideration-on-slack-notifications-config/7800/6 "2020-08-05T14:51:46Z")

</div>

This is working for me. Please review your configuration.

> <https://github.com/BanzaiMan/travis_staging_test/commit/bb0b051cc59d17fdca9f4fe83e423113647963fb>

  
did not trigger a notification, while  

> <https://github.com/BanzaiMan/travis_staging_test/commit/39c587aae145fec39eccb91b9d7cde823df0bb82>

  
did.

![Screen Shot 2020-08-05 at 10.49.28](https://us1.discourse-cdn.com/flex015/uploads/travis_ci/original/2X/d/dc1cf377045b44366676b064e0811cebe2b42ea6.png)

---

<div class="post-metadata">

**Author:** ![dove-young](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/dove-young/32/6961_2.png) [@dove-young](https://travis-ci.community/u/dove-young)\
**Post date:** [September 10, 2021, 8:56am UTC](https://travis-ci.community/t/condition-not-taken-into-consideration-on-slack-notifications-config/7800/7 "2021-09-10T08:56:15Z")

</div>

I tried this config, but it still notify on branch `test. I am running with Travis Enterprise.

```auto
notifications:
  slack:
    if: branch = release-3
    rooms:
      - secure: xxxxx
    on_success: always
    on_failure: always

```
