Slack notifications from Bitbucket Server or Data Center user guide.

Purpose

The main purpose of Slack notification for Bitbucket app is to increase team visibility and reduce notification noise

Functionality

Functionality is to notify users about pull requests and push activities. There are global and repository specific configurations. Repository specific configuration can override global settings.

This Bitbucket Server and Data Center plugin to handle both cases:

  • Send slack messages about pull request activities and push operations

  • Configure the size of the message from Minimal, Compact and Verbose.

  • Filter by source and destination branches

  • Configure settings on global, project (since version 3.12.07) and repository levels.

  • Override global and project settings on the repository level.

  • Override global settings on the project and repository levels.

Short demo

Below you can see a short demo on how to configure Bitbucket Slack integration.

Frequently Asked Questions

Slack integration with Bitbucket Frequently Asked Questions

Project level configuration demo

Getting and installing the plugin

You can grab the latest release from Atlassian Marketplace. Download the jar file and install it into your Bitbucket instance from the manage Apps page.

Configuring the plugin

Slack configuration

You need to create an incoming web hook in Slack. Go to slack home using a web browser, and select Add Integrations. Scroll to the bottom, and select Incoming WebHooks (click on Add). This will generate the hook url.

Bitbucket notifications to Slack plugin configuration

There are 3 places for the configuration. First is the global setting page that you can access from the Bitbucket administration. The second on is in the Project settings, which covers all repositories of a particular project. Project-level configuration works well for smaller Bitbucket projects or when a team owns a project.

On the repository level you can override repository specific preferences and settings to narrow down events.

Below you can see pull request notifications.

Bitbucket repository push notifications.

Branch filters

Additionally, you can setup Channels and branches patterns. Using this setting you can configure which Slack channel should be used for notifications about events in particular branch(s).

It accepts a single channel name (example: #it-admins), or you can add a comma separated list of pairs (pattern->channel). In this case the format must be: PATTERN->CHANNELNAME,ANOTHERPATTERN->ANOTHERCHANNELNAME. Pattern will match against the current ref name ignoring the "refs/heads" part. For instance, if you want to match refs/heads/bugfix/mybug42 and all other bug fix branches, add a pattern as bugfix/.* You can also leave it empty. When empty, the default channel will be used within the webhook.

Note: the branch filter is an event destination branch (“to” branch selected by default). It is important for some pull requests events.

For instance, if you want to be notified when the pull request is merged and filter by branch. You have to use the destination branch (“to” branch).

The from branch is used to filter by the source branch. Normally, it is used for the pull requests activities.

For example, I’ve got a branch issue/DEV-564-slack-card-refactoring and I want to receive notifications about PR comments to slack into my channel. I will setup `issue/DEV-564-slack-card-refactoring->#pull-request-comments`.

You have the option to enable notifications on a per repository basis. Go to your repository settings page, select Slack settings and enable pull request and/or push notifications with the check boxes. You can override here the default global settings.

Additional filters

There are 4 additional filters are present:

  • users that triggered the events (users whitelist).

  • users that triggered the events and should be ignored (users blacklist).

  • user groups a user that had triggered an event should belong to (user groups whitelist).

  • user groups a user that had triggered an event should belong to and will be ignored (user groups blacklist).

Override settings for global slack notification options - If enabled, Slack notifications will use the settings defined on the repository level instead of global settings. This flag overrides pull request filters or push notification options. Note, if you enable the flag, you MUST set a channel name as well (only the hook is not required).

Here is an example screenshot about the push notifications:

Happy Slack notifications!

If you have any questions please let us know.

Debugging

You need to enable debug mode for Bitbucket and supply us with the support zip or Bitbucket log file.

Updated: