Bitbucket is a terrific Git repository management solution for hosting and collaborating on code. But despite Bitbucket’s handy collaboration features, many teams still rely on Slack as their central communication platform. As a result, you can quickly tire of switching between the platforms constantly. Or you may find vital communication in your Git platform getting lost in the noise. If so, the Bitbucket and Slack integration may be the answer to your problems.
What is the Bitbucket Slack Integration Anyway?
Most developers can relate to the struggle of app-hopping. Bitbucket may be your primary tool for version control. But, you still need to hop on Slack to touch base with other collaborators. Also, most teams already use Slack as their main “office.” This is especially true for dispersed teams.
What if working in both environments from a unified dashboard is possible?
This is precisely what Bitbucket-Slack integration promises to do. With integration, you can perform crucial Bitbucket actions without leaving your Slack channel. This way, you can touch base with the team while keeping an eye on new developments in your code.
This situation makes perfect sense since most people spend most of their time on Slack anyway. So you’ll essentially be managing code without having to leave Slack. For most developer teams, there is no option to choose between the two platforms anyway. Each option offers its unique contributions. Therefore, integration is the next best thing to using a single platform for all your development needs.
How Bitbucket’s Slack Integration Works
There are several ways to integrate Bitbucket with Slack, including third-party solutions like Zapier and Automate.io. But Atlassian has created a nifty app called Bitbucket Cloud bot for Slack. While third-party plugins may work well, they typically have issues with noisy notifications.
The app allows seamless integrations and highly customized notification settings. It even monitors your usage patterns in Bitbucket to customize your notification settings. Plus the app is free and takes only a few minutes to install and configure.
This integration gives you the best of both worlds. First, team members can connect their Slack accounts to Bitbucket. Then it’s a quick road to turning Bitbucket events into Slack notifications. This way, no critical communication gets lost from constantly switching platforms to stay on top of the project’s progress.
The new Bitbucket app overhauls the old integration and comes with nifty new features that your team will appreciate. You can even perform Bitbucket actions like merging or commenting on pull requests from your Slack channel.
Below we have three examples of the Bitbucket Slack integration in action.
Example 1: Reference Bitbucket Issues with Slack @Mention
One common feature between Bitbucket and Slack is collaboration. For example, every notification on Bitbucket references at least one person. Whether that’s the assignee of an issue, a reviewer on a pull request, or the author of a commit. Team members play a central role in Bitbucket notifications.
User mapping makes it possible to render a user’s Slack display name on a Bitbucket notification rather than their Bitbucket Cloud user name. This way, you can use the Slack @mention feature to notify team members about something that requires their attention on Bitbucket.
You won’t have to act in Bitbucket and then reference it separately in Slack. As a result, you’ll save time and reduce the chances of anything falling through the cracks. This process is also much easier on team members that aren’t too familiar with Git and are only responsible for basic code-related tasks.
The mentioned members will receive a notification on their Slack desktop or a push notification on mobile. Similarly, the app also comes with a “shmention” option for when you need to refer someone and don’t want to send them a notification. This feature is handy for keeping notification noise to a minimum.
For example, a user recently performed an event such as pushing a commit. Or you need to reference them but they aren’t required to take any action. The shmention feature still references the individual, but they do not receive a notification. This thoughtful feature dramatically reduces the number of unnecessary Slack notifications.
Additionally, you can share code snippets directly in Slack. This feature is handy for creating context when collaborating with team members. You can also comment on the snippets and get notified when other users share their input.
Example 2: Follow Up On Outstanding Pull Requests
Pull requests can easily get lost in the barrage of daily pings and notifications. It’s also challenging to know whether the review is taking some time or if it’s been overlooked. Still, you may not have the luxury of popping by the reviewer’s desk to remind them about an outstanding PR.
The Bitbucket bot in Slack allows you to send follow-up pings directly from Slack. So you can get around waiting endlessly for approval by sending out a polite reminder. You don’t even need to struggle with the right words for your reviewer. The app sends a default message firmly but politely reminding the reviewer to approve your request.
Each pull request notification comes with a Nudge reviewers button. Simply click the button, and the reviewer gets a prewritten DM to perform the necessary action. Then Slack sends it as a direct message where it’s sure to be seen.
The notification also includes the latest status, so everyone knows exactly what’s happening. Finally, the reviewer gets a checkmark against their name once they approve the request. From then on, you can shmention them unless they are required to perform a specific action. Team members can also see who is lagging, applying some much-needed social pressure to move things along.
Example 3: Work On Bitbucket Pipelines from Your Slack Channels
The Bitbucket Slack integration is primarily about unifying collaboration on both platforms. But, the app allows essential Bitbucket functionality right from your Slack channel. Most notably, you can work on your Bitbucket pipelines without leaving Slack.
First, you’ll be able to set up your desired pipeline notifications, such as pipeline failed. Then, you’ll receive a notification on Slack in case your pipeline fails. Sometimes, the fix is as simple as rerunning the pipeline. This scenario is especially true if the pipeline fails because of insufficient resources in an external deployment tool.
In this case, the Slack notification comes with the option to rerun the pipeline. Simply click the button, and you are good to go. You don’t need to go back and forth between Slack and Bitbucket to remedy the situation.
Again, you don’t need to leave Slack to determine if your action was successful. The app also offers a pipeline fixed notification. This way, the entire team will be notified as soon as the bug is resolved and the pipeline is back to a successful state. Again, all this happens in Slack.
Finally, you get all the pipeline contextual information you need right in Slack. Every pipeline referenced in your channel comes complete with crucial Bitbucket information, including the pipeline status, commit, branch, and duration. This way, your team is constantly in the loop without needing to leave slack.
How to Get Started With the Bitbucket Slack Integration
Bitbucket Slack integration comes with many conveniences worth taking advantage of. Although there are multiple ways to integrate the two platforms, your best bet is the Bitbucket Cloud bot for Slack. If nothing else, it’s an Atlassian-made app optimized for Slack.
Here’s how to get started with Bitbucket Slack integration:
Step 1 – Remove Slack Webhooks (Optional)
The initial Bitbucket Slack integration is known as Webhooks. It’s a good idea to remove this integration if you’re already using it. This way, you won’t receive double notifications. Additionally, it may not be possible to use the Bitbucket Cloud bot for the Slack app if you’re currently using Webhooks.
The same applies to any previous Bitbucket-Slack integration you might be using. If not, feel free to jump to Step 2.
To remove Slack Webhooks:
- Log into your Bitbucket account.
- Go to the Repository settings and click Webhooks.
- Select the Slack Webhooks and click Delete.
Similarly, you’ll need to delete any Bitbucket integrations from your Slack account. To do this:
- Log into your Slack account.
- Go to the Slack App Directory and click Manage.
- Navigate to the Bitbucket app and click Remove app.
Step 2 – Install Bitbucket Cloud Bot for Slack
First, you’ll need to connect your Bitbucket and Slack platforms. The Bitbucket bot for Slack is the portal for the integration. So, you’ll need to install the app to get started.
To install the Bitbucket bot for the Slack app:
- First, log into your Bitbucket account.
- Make sure you’re also logged into Slack. Otherwise, you’ll get a notification to log in when you attempt to connect the two accounts.
- Open the repository you’d like to configure Slack notifications for.
- Navigate to Repository settings and click Slack > Settings.
- Click the Connect button.
- Select the specific workspace you’d like to connect to your Bitbucket repository.
You’ll receive a message in Slack confirming that you’ve linked your accounts.
Step 3 – Connect Slack Channels to Bitbucket Repositories
You’ve successfully connected your Slack and Bitbucket accounts. But you won’t be able to get Bitbucket notifications in Slack just yet. You’ll first need to specify the Bitbucket repository you’d like to connect to a Slack channel.
So, you’ll be adding subscriptions to your Slack channel. To do this:
- Log into your Bitbucket account.
- Open the specific repository you want to add notifications to.
- Go to Repository settings > Slack > Settings.
- Click Add subscription.
By default, this configuration only works for public channels. However, you can create subscriptions for private channels manually from Slack. Simply go to the private channel, and type /bitbucket connect.
Finally, repeat the process for all the repositories you want to integrate with your Slack channels.
Step 4 – Configure Notifications for Your Subscriptions
The great thing about the Bitbucket Cloud bot for Slack is that it lets you set up the relevant notifications. This way, you don’t clog Slack with endless and unnecessary messages. You can also configure the notifications for each repository. You get granular control here, including choosing specific branches to receive notifications.
To configure your notifications:
- Open the repository you connected to Slack.
- Go to Repository settings.
- Click Slack > Settings.
- Select the repository-wide option to get notifications for all the branches in the repository.
- Alternatively, select a branching pattern. Here, you’ll receive notifications from all new branches that align with a specific branch pattern.
- Or select a specific branch. Then, you’ll only receive notifications for only that branch.
Finally, select the actions you’d like to trigger notifications to Slack. For example, you can choose to receive a notification when someone creates a fork in the repository or if a pipeline is completed successfully. Again, you get granular control. You can allow notifications for a repository, build, branches, pipeline, tags, pull requests, issue tracking, or automated related actions.
However, you don’t need to get bogged down with the details if you feel overwhelmed. Bitbucket learns your notification patterns and can customize many of these notifications for you. It’s also worth consulting with your team about which actions warrant messages. Getting this initial buy-in will reduce resistance to the new style of working.
Step 5 – Explore Your Integration
Besides what we’ve mentioned so far, there’s a lot you can do with your new Bitbucket-Slack integration. For example, you’ll be able to merge pull requests from slack once they’re approved. You also get the merge button in the Slack app to merge PRs on the go. However, pull requests won’t merge unless they’ve passed a merge-check if you use this in your workflow.
Furthermore, you can create pull request comments as Slack messages. This feature is handy for making sure pull request details don’t get lost in the conversation. Pull requests often get lost during a heated discussion with multiple team members. Clicking the link also takes you back to the original chat to gain the full context of the comment.
So, take your time exploring the different capabilities that the Bitbucket-Slack integration makes possible. It’s also a good idea to create standard documentation for how your team will use the integration. For example, you can specify which conversations happen in Slack and what is more appropriate for Bitbucket’s collaboration features.