Skip to content

BitBucket Integration for Rocket.Chat

Notifications You must be signed in to change notification settings

PapooSoftware/BitRocket

 
 

Repository files navigation

Bitrocket Logo

BitRocket


Overview | Features | Installation | Team | Copyright & License



Overview

Connect Alassian BitBucket Server or Alassian BitBucket Cloud with Rocket.Chat and send notifications to users or channels on each push, pull requests or comments on pull requests to any branch.



Features

This script uses BitBuckets Post-Receive WebHooks to submit a payload to your Rocket.Chat instance, which parses the payload and then posts a message containing different information.




Installation

Download code

Download source from here.
Unzip Sources.


Configure Rocket.Chat

Add user (optional)

This step is optional if you've already got a user which you want to use as post author you can skip this step.
Otherwise add a new user who is posting the updates to your channel or who is texting the user which is supposed to be informed.

Configure incoming Webhook in Rocket.Chat

In your Rocket.Chat instance go to administration panel and click on "Integrations". To add an integration with BitRocket click on "NEW INTEGRATION".
Next, choose "Incoming WebHook".
Now, on the webhook config screen, set the following values:

Enabled

Set this value to true

Name (optional)

Enter the desired name for the integration (e.g. "BitRocket").

Post to Channel

Self-explaining option. Insert the desired channel or user which receives the post on pushing to your repositories.
An example user would be @username, an example channel would be #channelname.

Post as

Here you've got to define the user who is posting the updates. This is the user you've created earlier.

Script Enabled

Set this setting to true.

BitBucket Cloud Script

When using BitBucket Cloud you have to insert the complete code of the file BBCloud__POSTReceiveHook.js into this field.

Configure Messages:

First, configure your colors and, to get links working, configure your bitbucket server root url:

const config = {
    colorDefault: '#225159',
    colorError: '#8D2A12',
    colorSuccess: '#14720a',
    bitbucketUrl: '{ configure me :-) }'
};



Now set, which notification you want to receive in Rocket.Chat

const showNotifications = {
    'repo:refs_changed': true,
    'repo:forked': true,
    'repo:comment:added': true,
    'repo:comment:edited': true,
    'repo:comment:deleted': true,
    'pr:opened': true,
    'pr:reviewer:approved': true,
    'pr:reviewer:unapproved': true,
    'pr:reviewer:needs_work': true,
    'pr:merged': true,
    'pr:declined': true,
    'pr:deleted': true,
    'pr:comment:added': true,
    'pr:comment:deleted': true,
    'pr:comment:edited': true
};





BitBucket Server Script

When using BitBucket Server you have to insert the complete code of the file bitbucket_5_6_native-webhook.js into this field.

Save changes

Now click on "SAVE CHANGES" to get the required information (it is possible that you'll receive an empty error message below the "Script" option - just ignore it).



Configure BitBucket Cloud

Create Post-Receive WebHook in repository

Navigate to the desired repository and click on "Settings" in the left column.
Now click on "Webhooks" and then on "Add webhook".
The opening page provides an input field for defining your webhook title and your webhook url.
Please enter the correct url to your Rocket.Chat webhook (just copy it from Rocket.Chat integration settings).
On the "Triggers"-option select "Choose from a full list of triggers". In the following list check "Repository -> Push" and every option below "Pull Request"
You can select everything here and overwrite this settings in the script-config directly inside of Rocket.Chat.

Supported triggers
  • Repository Events
    • Push
    • Fork
    • Commit Comment Created
    • Commit Status Created (Example payload needed)
    • Commit Status Updated (Example payload needed)
  • Issue Events
    • Created (Example payload needed)
    • Updated (Example payload needed)
    • Comment Created (Example payload needed)
  • Pull Request Events
    • Created
    • Updated
    • Approved (BitBucket provides insufficient info)
    • Approval Removed (BitBucket provides insufficient info)
    • Merged
    • Declined
    • Comment Created
    • Comment Updated
    • Comment Deleted

Click on "Save" and your done!



Configure BitBucket Server

Create WebHook in repository

Navigate to the desired repository and click on "Settings" in the left column.
Now click on "Webhooks" and add a new one.
After inserting your data, previously entered in RocketChat test the connection.
Click on "Save" and your done!



Want to contribute?

Feel free to do.



Team

Manuel Bachl (m.bachl@finndrop.de)
Thies Schneider (t.schneider@finndrop.de)



Copyright & License

Finndrop Studios
Copyright (c) 2016 „Finndrop Studios

Licensed under the MIT license.

About

BitBucket Integration for Rocket.Chat

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%