# Bitbucket Integration Guide | PagerDuty

Integration Guide for Bitbucket

## Bitbucket + PagerDuty Benefits

- Bitbucket is Atlassian’s Git solution for professional teams, featuring pull requests, branch permissions and inline comments.
- Notify on-call engineers about failures within your Bitbucket pipelines.

## Requirements

- **In PagerDuty**: This integration requires a Manager base role or higher to configure.
- **In Bitbucket**: This integration requires users to be able to edit repository settings.

## How it Works

- When there is a failure in your Bitbucket pipelines, a PagerDuty incident will notify on-call responders.
- When the failure recovers, a `SUCCESSFUL` message is sent to PagerDuty and the PagerDuty incident will automatically resolve.

## Version

This integration is intended for Bitbucket Cloud.

## Integration Walkthrough

### In PagerDuty

1. In the PagerDuty web app, go to **Services**  →  **Service Directory**.
2. Select the PagerDuty service you wish to integrate with, then select the **Integrations** tab.
3. Click **Add an integration**.
4. Search for and select **Atlassian Bitbucket Pipelines**, then click **Add**.
5. You will be taken back to the **Integrations** tab showing the newly added integration. Click the name of the **Atlassian Bitbucket Pipelines** integration you created in the previous step.
6. Click  to copy the **Integration URL** to your clipboard, which will be in the following format: `https://events.pagerduty.com/integration/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/enqueue`. Keep this URL in a safe place, since you will need it in the [next section](#in-bitbucket) when you configure a webhook in your Bitbucket account.

![A screenshot of the PagerDuty UI showing where to copy the integration URL to your clipboard](/images/kb/d3bf5e826bc9c4f774a74820def0671645d9853395f09e4692383ee291155cef-copy_integration_key.webp)
*Copy integration URL*

### In Bitbucket

You will complete the rest of the configuration in Bitbucket, where you will add a webhook that sends build information to PagerDuty.

7. Open the repository you want to integrate with PagerDuty. From the left-side navigation, select **Repository settings**.
8. Select **Webhooks** from the **Workflow** subheading and click **Add Webhook**.
9. Enter a title, then paste the PagerDuty URL you copied from the [previous section](#in-pagerduty) into the field **URL**.
10. In the section **Triggers**, select **Build status updated** under **Repository**.

![A screenshot of the Bitbucket UI showing how to configure a webhook](/images/kb/2138e2b93bc514421a7e5a0ad61978279a1a657205f5595ec5fe1c6558c6e5a7-bitbucket_configuration.webp)
*Configure webhook*

11. Click **Save**.
12. _Optional_: Each repository in Bitbucket can be configured to send failure information to a different PagerDuty service. You can repeat the [Integration Walkthrough](#integration-walkthrough) as many times as needed, if you’d like to integrate PagerDuty with more than one Bitbucket repository.
