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.
Define which links in pull request notification should be shown
const showLinks = {
decline: true,
approve: true,
merge: true,
commits: true,
comments: true
};
Now set, which notification you want to receive in Rocket.Chat
const showNotifications = {
push: true,
fork: true,
comment: true,
pullrequest_created: true,
pullrequest_declined: true,
pullrequest_merged: true,
pullrequest_updated: true,
pullrequest_comment_created: true,
pullrequest_comment_deleted: true,
pullrequest_comment_updated: true
};
When using BitBucket Server you have to insert the complete code of the file BBServer_POSTReceiveHook.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 too less info)Approval Removed(BitBucket provides too less info)- Merged
- Declined
- Comment Created
- Comment Updated
- Comment Deleted
Click on "Save" and your done!
If it's not installed yet, you need to install the free BitBucket Server Web Post Hooks Plugin.
To install the plugin login to your BitBucket Server instance an navigate to Administration and there click on "Find new add-ons" under section ADD-ONS.
Search for BitBucket Server Web Post Hooks Plugin
and click on install.
Once the BitBucket Server Web Post Hooks Plugin is installed, navigate to the desired repository and click on "Settings" in the left column.
Now click on "Hooks" and enable "Post-Receive WebHooks".
After enabling "Post-Receive WebHooks" klick on the little pen-icon next to the plugin title. The opening modal provides an input field for defining your webhook url.
Please enter the correct url to your Rocket.Chat webhook (just copy it from Rocket.Chat integration settings).
Click on "Save" and your done!
To test wether communication between Bitbuket and Rocket.Chat works or not, just push any changes to the repository you've set up the hook.
Did your channel or user receive a notification about the push? Congrats - everything is fine!
No message received? Please double check all steps. If everything is set up as mentioned in this how to and it still doesn't work, feel free to drop us a line!
To inform your Rocket.Chat channel or user about changes on other repositories, just follow the instructions on how to create the Post-Receive WebHook in BitBucket Cloud/Server again. You're not limited in the number of repositories which send information to Rocket.Chat.
If you have any ideas on how to make this script way better, feel free to contact us. We would love to add more features. Let's improve this work together!
Manuel Bachl ([email protected])
Thies Schneider ([email protected])
Copyright (c) 2016 „Finndrop Studios“
Licensed under the MIT license.