Overview | Features | Installation | Team | Copyright & License
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.
This script uses BitBuckets Post-Receive WebHooks to submit a payload to your Rocket.Chat intance, which parses the payload and then posts a message containing differen information.
Download source from here.
Unzip Sources.
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 ist texting the user which is supposed to be informed.
In your Rocket.Chat instance go to administration panel an 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:
Set this value to true
Enter the desired name for the integration (e.g. "BitRocket").
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
.
Here you've got to define the user who is posting the updates. This is the user you've created earlier.
Set this setting to true.
When using BitBucket Cloud you have to insert the complete code of the file BBCloud__POSTReceiveHook.js
into this field.
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
};
When using BitBucket Server you have to insert the complete code of the file bitbucket_5_6_native-webhook.js
into this field.
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).
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.
- 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!
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!
I forked this from FinndropStudios/BitRocket. Feel free to also do this.
Manuel Bachl ([email protected])
Thies Schneider ([email protected])
Markus Bauer ([email protected])
Copyright (c) 2016 โFinndrop Studiosโ
Licensed under the MIT license.