Skip to main content

Slack Notification

OneDev added ability to send slack notifications since version 7.5. With this integration, you can select to route events matching different criterias to different channels. This integration also leverages project setting inheritance/override to let you define common notification settings in parent project, and selectively override some of them in child projects. This tutorial explores these features with an example setup.

Create Webhook at Slack Side

Firstable, you need to create a new app in your Slack workspace and set up appropriate incoming webhooks.

  1. Visit api.slack.com to create a new app from scratch for your workspace, name it OneDev for instance
  2. Enable incoming webhooks and add webhook for appropriate channels

In this example, we create webhooks for two channels, one to receive high priority issue notifications, and another to receive release build notifications

Configure OneDev to Post Events to Slack

  1. At OneDev side, open Slack notifications page of your project, and add a notification like below:

    Copy webhook url we created at Slack side into this page, and configure appropriate event notification options. Here we use webhook url for channel #important-issues and tell OneDev to post events of all issue with Priority field set to Critical to this url

    Multiple notification entry can be added for a single project, and we continue to add another entry to post events of all builds of job Release to webhook url for channel #releases like below

  2. Save Slack notification setting. Now open a critical issue in OneDev, you will get Slack notification in channel #important-issues:

    Also a new release build will post several events to the #releases channel like below:

    If you only want to receive build finished notification for release job, just specify Applicable Builds of above setting as below:

    “Job” is “Release” and finished

Setting Inheritance and Override

All notification setting will be inherited by child configurations automatically. Child configurations may define their own notification settings, and they will function together with inherited settings. To override an inherited setting in child configuration, just define a new setting with same webhook url, and specify notify options.

That’s it. Thanks for reading.