Repository administrators can add a Pull Request POST hook to a repository. Bitbucket POSTs pull request event data to a hook URL you specify. You specify a URL in the format:
Bitbucket supports HTTPS and basic authentication. When configuring the pull request POST hook, you can choose to get event data about the following:
|Approve / Unapprove||Fires when user sets or unsets Approve for a pull request.|
|Comments||Fires when a user creates, edits, or deletes a pull request comment.|
|Create / Edit / Merge / Decline||Fires when a user creates, edits, merges, or declines a pull request.|
The content header of the POST has an
application/json type. This hooks behave similarly to an HTTP publish/subscribe hook. The payload is a json document.
The POST request originates from the IP addresses 188.8.131.52 and 184.108.40.206. You may need to configure your firewall to accept connections from these IP addresses.
Configure the Pull Request POST hook
You can set up the POST hook manually or you can write a hook to automate this. You would write a hook if you are integrating an application with Bitbucket.
Manually configure from the repository administration page
- Go to the repository's settings.
- Click Hooks in the left-hand navigation.
The Hooks page appears.
- Select the Pull Request POST hook from the Hook dropdown.
- Click Add hook.
A new section appears for the POST hook.
Enter the URL where Bitbucket should send its update messages.
- Choose the pull request events you are interested in by checking the corresponding box.
- Press Save.
Automatically configure the URL from another application
If you are integrating with Bitbucket and looking for an easy way to add the hook for your users, there are two methods you can use to automate this. You can send the user to a URL structured in the following way:
If you're using OAuth or passing through basic authentication, you can use the api to accomplish this as well
Examples of POST data
When a user makes pull request's against a repository, Bitbucket POSTs to the URL you provided. The POST request body contains information about the pull request change.