Slack Bitbucket Integration

Iain Watt picture Iain Watt · Dec 10, 2015 · Viewed 24.5k times · Source

I get 403 errors and a hanging page when i try to set up slack integrations, any idea what causes this?

These are the URL's

GET bitbucket.org/api/2.0/repositories/MyAccount/repo-name/hooks/?pagelen=100

POST bitbucket.org/api/2.0/repositories/MyAccount/repo-name/hooks/

If anyone else knows bitbucket well there is also the option to prevent deletion of repos which when i try to enable a !Forbidden message also appears. Are these related to my account being on the free tier? There is very little error feedback.

Answer

Thiago Gouvea picture Thiago Gouvea · Jan 8, 2016

edit

From Atlassian's Bitbucket Cloud for Slack how-to:

(Requires repo admin permissions)

  1. Log into Bitbucket
  2. Open a specific repository to add notifications to, in the account that is connected to Slack.
  3. Click Settings then select Chat notifications > Settings.
  4. Choose one of the following:

    • Click Add subscription, if you've already connected this repository to Slack.
    • Click the connect button, if this the first time your
      connecting a repository to your Slack workspace.
    • Click Add subscription and then select Add new workspace, if you’re adding a new subscription, to a new workspace.
  5. Choose the Slack workspace and channel to connect to your repository.

/edit


Not sure how you're trying to do it, but here is how I got mine to work:

  1. Make sure you have the Bitbucket app installed on Slack. It should show up on your yourteam.slack.com/apps/manage page. In case it doesn't, search Bitbucket on the app directory

  2. Once in the Bitbucket app page on Slack, go to its configuration page (or create a new configuration). Decide to which channel or user should Bitbucket notifications be posted.

  3. On the same page, find the Webhook URL. It looks something like https://hooks.slack.com/services/LONGST/RINGOF/RANDOMChAraCTeRS

  4. On your Bitbucket repository page, click Settings/Webhooks.

  5. Use the Slack URL to create a new Webhook. Assign a unique name to it. I believe Slack only supports Repository Push type of trigger.

I hope it works for you.