HOW TO ADD WEBHOOK IN BITBUCKET?
WHAT IS WEBHOOK?
There are many cases where an event happening in one system need to be informed to another system to trigger some related events/actions in the second system. Webhook is a web callback or HTTP push API, which will provide information and data about an event to other applications.
For example: Whenever new code gets committed (event) to a code repository (first system), you may want to setup a Webhookin the repository to run and alert the build and deployment tool (second system) to redeploy the application.
Webhooks help in application integrations. Apps can subscribe to certain events in other systems and will get informed when such events happen in the subscribed system. In the above example, Build and Deployment Tool has subscribed for code commit events in the Code Repository System using Webhook.
ADDING A BITBUCKET WEBHOOK
Step 1: Login & Select a Repository
Login to Bitbucket and navigate to your code repository. WordPress repository is selected as an example below.
Step 2: Open Settings
Click on the Repository Settings tab to expand it and to view the Webhooksub menu
Step 3: Open WebhookManagement Screen
Click on the Webhookmenu from the left menu panel to open the Webhookmanagement screen.
Step 4: Edit/Add Webhook information
i) Click on the Add Webhook button in the Webhook management screen
ii) Add the following information in the Add Webhook screen
- Title: <enter a suitable title>
- URL: <enter theWebhook URL here >
- SSL/TLS : <setup certificate verification, if needed>
- Trigger: <Select the trigger events you are interested in. (By default Repository Push)>
- Click Savebutton.
This will enable Bitbucket to send a POST request to the URL specified based on alerts set.
Now you have successfully completed setting up a Webhook for your Git repository.
Interested in reading similar articles? Please follow us on LinkedIn.
About The Author
Dr. Anil Kumar
VP Engineering, CLOUD CONTROL
Founder | Vice President | CTO | Architect | Consultant | Mentor | Advisor | Faculty
Solution Architect and IT Consultant with more than 25 years of IT Experience. Served various roles with both national and international institutions. Expertise in working with both legacy and advanced technology stacks and business domains.