This repository is community supported and not maintained by Mattermost. Mattermost disclaims liability for integrations, including Third Party Integrations and Mattermost Integrations. Integrations may be modified or discontinued at any time.
A Bitbucket plugin for Mattermost. Based on the mattermost-plugin-bitbucket developed by jfrerich.
The Bitbucket plugin features include:
- Daily reminders: The first time you log in to Mattermost each day, get a post letting you know what issues and pull requests need your attention.
- Notifications: Get a direct message in Mattermost when someone mentions you, requests your review, comments on, or modifies one of your pull requests/issues, or assigns you on Bitbucket.
- Post actions: Create a Bitbucket issue from a post or attach a post message to an issue. Hover over a post to reveal the post actions menu and select More Actions (...).
- Sidebar buttons: Stay up-to-date with how many reviews, assignments, and open pull requests you have with buttons in the Mattermost sidebar.
- Slash commands: Interact with the Bitbucket plugin using the
/bitbucket
slash command.
This guide is intended for Mattermost System Admins setting up the Bitbucket plugin and Mattermost users who want information about the plugin functionality. For more information about contributing to this plugin, visit the Development section. The Mattermost Bitbucket plugin uses a webhook to connect your Bitbucket account to Mattermost to listen for incoming Bitbucket events. Events notifications are via Direct Message in Mattermost. The Events don’t need separate configuration.
This guide assumes:
- You have a Bitbucket account.
- You're a Mattermost System Admin.
- You're running Mattermost Server v5.25 or higher.
Download the latest plugin binary release and upload it to your server via System Console > Plugin Management. To learn more about how to upload a plugin, see the documentation.
Configuration is started in Bitbucket and completed in Mattermost.
- Go to https://bitbucket.org and log in.
- From your profile avatar in the bottom left, select the workspace in the Recent workspaces list or select All workspaces for a full list.
- Select Settings in the left sidebar to open the workspace settings.
- Under Apps and features, select OAuth consumers.
- Select Add consumer and set the following values:
- Name:
Mattermost Bitbucket Plugin - <your company name>
. - Callback URL:
https://your-mattermost-url.com/plugins/bitbucket/oauth/complete
, replacinghttps://your-mattermost-url.com
with your Mattermost deployment's Site URL. - URL: https://github.com/mattermost/mattermost-plugin-bitbucket.
- Name:
- Set:
- Account:
Email
andRead
permissions. - Projects:
Read
permission. - Repositories:
Read
andWrite
permissions. - Pull requests:
Read permission
. - Issues:
Read
andWrite
permissions.
- Account:
- Save the Key and Secret in the resulting screen.
- Go to System Console > Plugins > Bitbucket
- Enter the Bitbucket OAuth Client ID and Bitbucket OAuth Client Secret you copied in a previous step.
- Select Save.
You must create a webhook for each repository you want to receive notifications for or subscribe to.
- Go to the Repository settings page of the Bitbucket organization you want to send notifications from, then select Webhooks in the sidebar.
- Select Add Webhook.
- Set the following values:
- Title:
Mattermost Bitbucket Webhook - <repository_name>
, replacingrepository_name
with the name of your repository. - URL:
https://your-mattermost-url.com/plugins/bitbucket/webhook?secret=SOME_SECRET
- replace
https://your-mattermost-url.com
with your Mattermost deployment's Site URL. - replace
SOME_SECRET
with the secret generated in System Console > Plugins > Bitbucket > Webhook Secret.
- replace
- Title:
- Select Choose from a full list of triggers.
- Select:
- Repository:
Push
. - Pull Request:
Created
,Updated
,Approved
,Approval removed
,Merged
,Declined
,Comment created
. - Issue:
Created
,Updated
,Comment created
.
- Repository:
- Select Save.
If you have multiple repositories, repeat the process to create a webhook for each repository.
If you have an existing Mattermost user account with the name bitbucket
, the plugin will post using the bitbucket
account but without a BOT tag.
To prevent this, either:
Convert the bitbucket
user to a bot account by running mattermost user convert bitbucket --bot
in the CLI.
or
If the user is an existing user account you want to preserve, change its username and restart the Mattermost server. Once restarted, the plugin will create a bot account with the name bitbucket
.
Open System Console > Plugins > Bitbucket and do the following:
- Generate a new value for At Rest Encryption Key.
- (Optional) Bitbucket Organization: Lock the plugin to a single Bitbucket organization by setting this field to the name of your Bitbucket organization.
- Select Save.
- Go to System Console > Plugins > Management and select Enable to enable the Bitbucket plugin.
You're all set!
When you’ve tested the plugin and confirmed it’s working, notify your team so they can connect their Bitbucket account to Mattermost and get started. Copy and paste the text below, edit it to suit your requirements, and send it out.
Hi team, We've set up the Mattermost Bitbucket plugin, so you can get notifications in Mattermost. To get started, run the
/bitbucket connect
slash command from any channel within Mattermost to connect your Mattermost and Bitbucket accounts. Then, take a look at the slash commands section for details about how to use the plugin.
- Subscribe to a respository: Use
/bitbucket subscriptions add
to subscribe a Mattermost channel to receive notifications for new pull requests, issues, branch creation, and more in a Bitbucket repository.- For instance, to post notifications for issues, issue comments, and pull requests from mattermost/mattermost-server, use:
/bitbucket subscribe mattermost/mattermost-server issues,pulls,issue_comments
- For instance, to post notifications for issues, issue comments, and pull requests from mattermost/mattermost-server, use:
- Get to do items: Use
/bitbucket todo
to get an ephemeral message with items to do in Bitbucket, including a list of assigned issues and pull requests awaiting your review. - Update settings: Use
/bitbucket settings
to update your settings for notifications and daily reminders.
Run /bitbucket help
to see what else the slash command can do.
Feel free to create a GitHub issue or join the Bitbucket Plugin channel on our community Mattermost instance to discuss.
Bitbucket user tokens are AES-encrypted with an At Rest Encryption Key configured in the plugin's settings page. Once encrypted, the tokens are saved in the PluginKeyValueStore
table in your Mattermost database.
This plugin contains both a server and web app portion. Read our documentation about the Developer Workflow and Developer Setup for more information about developing and extending plugins.
The version of a plugin is determined at compile time, automatically populating a version
field in the plugin manifest:
- If the current commit matches a tag, the version will match after stripping any leading
v
, e.g.1.3.1
. - Otherwise, the version will combine the nearest tag with
git rev-parse --short HEAD
, e.g.1.3.1+d06e53e1
. - If there is no version tag, an empty version will be combined with the short hash, e.g.
0.0.0+76081421
.
To disable this behaviour, manually populate and maintain the version
field.
This repository is licensed under the Apache 2.0 License.