Home

Awesome

bitbucket-slack-notifier

This is simple BitBucket Server -> Slack Notifier service.

The initial goal was to notify reviewers on any changes configured.

Intended to use with https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket

This is only the interceptor of outgoing requests from Pull Request Notifier plugin.

The idea is to not just post in a channel for all PR's changes but to immediately send private messages to the required people only.

This is very helpful and really speeds up the common BitBucket workflow.

Features

How it works

This is just an example service that turns PR Notifier plugin messages into slack messages. It receives message from plugin on defined trigger and sends them yo your slack bot.

User channel mappings

All of the messages go to private @ Slack channels. Previously this was just working out of the box with account names, because Slack had the possibility to change channel Id via UI. Now it's not possible and channel Id is usually first part of the email from invite. Like john.doe@mail.com will create the private Slack channel @john.doe. You'll need to add a mapping between BitBucket account and your slack channel to file users.json. This file will be used once the notification is being sent to find channel name of the author/reviewer/commenter.

There's a Web UI included for managing this mapping, located here: http://localhost:9999/ (sources and instructions here)

Usage

  1. Install Slack and open management web app
  2. Add custom integration - bot and configure all fields. Copy bot token
  3. Install BitBucket and get Pull Request Notifier plugin via Atlassian Marketplace
  4. Create 3 triggers in plugin
  1. Add basic button [] to toggle messages on click (main trigger)
  2. Clone this project
  3. Install node.js with NPM
  4. Run npm install to get dependencies
  5. Rename example-variables.json into variables.json and configure required fields - most importantly add bot token from slack
  6. Add user mappings between BitBucket account name and Slack channel name to users.json like: "bitBucketUserName":"slack.username" OR via web-interface at http://localhost:9999/#/
  7. Run node notifier to start the service (i would suggest using pm2 to demonize the service on the server)
  8. Fork for any required changes in the message

TODO