Understanding Bitbucket Webhooks: 3 Critical Aspects

on Data Integration, ETL, Webhook • October 20th, 2021 • Write for Hevo

In the programming world, code management is a high-priority subject. Many developers collaborate in a single project, and slight mismanage of code can waste hours of effort. In this blog post, we will talk about such a version control tool – BitBucket that manages the entire version history of code and provides other features such as CI/CD, Webhooks, user management, JIRA integration, etc.

This blog talks about the critical aspects of Bitbucket and Webhooks before delving deeper into the steps required to set up Bitbucket Webhooks.

Table of Contents

Introduction to BitBucket

Bitbucket Webhook: Bitbucket Logo
Image Source

BitBucket is a cloud-based service that stores and manages developers’ code and allows them to track the changes made. It is based on the cloud-based Git repository, supports all the Git CLI commands, and has a simple and user-friendly UI  that allows even novice users to use it efficiently. BitBucket provides additional services like CI/CD, pipeline, teams collaborations, create projects, set up automated pipelines, test & deploy code.

Key Features of BitBucket

  • BitBucket has an excellent and super fast Code Review System that helps developers to review the pull requests.
  • BitBucket also features a side-by-side comparison between different versions of code in UI.
  • BitBucket seamlessly integrates with JIRA allowing users to track bugs and monitor the status.
  • BitBucket also features inline comments within code snippets allowing developers to provide feedback on pull requests straight away without leaving the current tool.
  • BitBucket interface is quite simple to use. Users can easily find repositories, pull requests, branches, usernames, and other features of the tools.

BitBucket Advantages

  • BitBucket has an excellent query management system that provides an integrated approach to make work easy.
  • Bitbucket has excellent integration with Github and allows users to authenticate via Github.
  • BitBucket is well integrated with JIRA to track bugs and stories automatically.
  • Bitbucket allows users to import repositories from third-party version control systems.
  • Bitbucket is free for small teams (up to 1 to 5 users). Single users can create unlimited private repositories.

BitBucket Disadvantages

  • BitBucket is only free for a team of up to 5 members. If the team size is large, you have to pay for an additional member.
  • BitBucket doesn’t have the same simplified PR management tools as other competitors.
  • BitBucket is not as evolved as Github in code lookup, and there are several search-related issues.

Simplify your Webhooks ETL with Hevo’s No-code Data Pipeline

A fully managed No-code Data Pipeline platform like Hevo Data helps you integrate and load data from 100+ Data Sources (including 40 Free Data Sources like Webhooks) to a destination of your choice in real-time in an effortless manner. 

Get Started with Hevo for Free

Hevo with its minimal learning curve can be set up in just a few minutes allowing the users to load data without having to compromise performance. Its strong integration with umpteenth sources allows users to bring in data of different kinds in a smooth fashion without having to code a single line. 

Check out some of the cool features of Hevo:

  • Completely Automated: The Hevo platform can be set up in just a few minutes and requires minimal maintenance.
  • Transformations: Hevo provides preload transformations through Python code. It also allows you to run transformation code for each event in the Data Pipelines you set up. You need to edit the event object’s properties received in the transform method as a parameter to carry out the transformation. Hevo also offers drag and drop transformations like Date and Control Functions, JSON, and Event Manipulation to name a few. These can be configured and tested before putting them to use.
  • Connectors: Hevo supports 100+ integrations to SaaS platforms, files, databases, analytics, Webhooks, and BI tools. It supports various destinations including Amazon Redshift, Snowflake Data Warehouses; Amazon S3 Data Lakes; and MySQL, SQL Server, TokuDB, DynamoDB, PostgreSQL databases to name a few.  
  • Real-Time Data Transfer: Hevo provides real-time data migration, so you can have analysis-ready data always.
  • 100% Complete & Accurate Data Transfer: Hevo’s robust infrastructure ensures reliable data transfer with zero data loss.
  • Scalable Infrastructure: Hevo has in-built integrations for 100+ sources that can help you scale your data infrastructure as required.
  • 24/7 Live Support: The Hevo team is available round the clock to extend exceptional support to you through chat, email, and support calls.
  • Schema Management: Hevo takes away the tedious task of schema management & automatically detects the schema of incoming data and maps it to the destination schema.
  • Live Monitoring: Hevo allows you to monitor the data flow so you can check where your data is at a particular point in time.
Sign up here for a 14-Day Free Trial!

Introduction to Webhooks

Bitbucket Webhook: Webhook Logo
Image Source

Webhooks are the ways of communicating between two apps by sending notifications or alerts when something happens. Webhooks are automated messages sent from apps during any event. They have a payload or message, which is sent to a unique URL.

When an event happens on the trigger application, it serializes the data about that event and sends it to a Webhook URL from the action application. This is defined as the one you want to do something based on the data collated from the first application. This Action application can then send a callback message, alongside an HTTP status code like 302. This lets the trigger application know if the data has been received successfully or a status code of 404 if not.

Generally, Webhooks can be set up with a three-step process:

  • Get the Webhook URL from the application you wish to send data to.
  • Next, you need to use that URL in the Webhook section of the application you want to receive the data from.
  • Finally, you can choose the type of events you want the application to notify you about.

There are several use-cases when the webhooks are very helpful; some examples are:

  • Notification email from Paypal alerts you when the client pays you.
  • In Bitbucket, every time a user pushes commits in a repository, you can use Webhooks to instantiate the CI pipeline.
  • Sending success/failure emails when the build passes/fails.

Webhooks are event-driven systems, which means it becomes active only when the desired event happens, and they are restricted to communicate over web protocol-HTTP.

Pre-requisites 

  • An active Bitbucket account. To create a new account, sign up to Bitbucket here.
  • A prior and basic understanding of BitBucket and version control systems.

Steps to Set up Bitbucket Webhooks

Here are the steps you can follow to set up Bitbucket Webhooks for your business use case:

Bitbucket Webhook Setup: Create a repository

  • Step 1: Log in to Bitbucket and create a new repository.
Bitbucket Webhook: Step 1.1
Image Source
  • Step 2: On the Create new repository page, and provide the necessary information.
Bitbucket Webhook: Step 1.2
Image Source

Bitbucket Webhook Setup: Create Webhooks

  • Step 1: Once the repository is created, navigate to the repository settings and then select Webhooks.
Bitbucket Webhook: Step 2.1
Image Source
Bitbucket Webhook: Step 2.1.1
Image Source
  • Step 2: On the Webhook page, click on Add Webhook.
Bitbucket Webhook: Step 2.2
Image Source
  • Step 3: Provide the Webhook Title and URL where the webhook requests will be sent to. Usually, the URL is an outlook server or any other IP where you wish to get notifications.
  • Step 4: Check the Active option if you want the webhook to be active after you save it.
  • Step 5: Check the Skip certificate verification option if you use self-signed certification and don’t need to verify it.
  • Step 6: Select the Triggers that you wanted the Bitbucket webhooks to be triggered by. 
Bitbucket Webhook: Step 2.6
Image Source
  • Step 7: Once done, click on Save to save Webhook.

Bitbucket Webhook Setup: Trigger Webhooks

  • Step 1: Now that we have created the Webhook, the Webhook will be triggered by Push, Commit, PR Approved, PR Declined and PR Comments Created (as selected above).
  • Step 2: Create a new file named file.txt and push that code to Bitbucket.
  • Step 3: As soon as the file is pushed, a Webhook event will be triggered and the notifications will be sent to the designated URL.

Bitbucket Webhook Setup: Modifying Webhooks

  • Step 1: Bitbucket provides a user-friendly interface to modify Webhooks. On the Webhook section, select Edit.
Bitbucket Webhook: Step 4.1
Image Source
  • Step 2: On the next page, you can edit URL, Triggers, SSL, and update the Webhook.
  • Step 3: Next time when that selected event happens, the Webhook will be triggered.

Conclusion

In this blog post, we have discussed BitBucket and Webhooks and how to create Webhooks in Bitbucket.

Extracting complex data from a diverse set of free data sources such as Webhooks can be a challenging task and this is where Hevo saves the day!

Visit our Website to Explore Hevo

Hevo Data offers a faster way to move data from 100+ Data Sources such as SaaS applications, Databases, etc. Hevo also provides a native Webhooks Connector that can help connect with a variety of non-native/custom sources or Databases into your Data Warehouse to be visualized in a BI tool. Hevo is fully automated and hence does not require you to code.

Want to take Hevo for a spin? Sign Up for a 14-day free trial and experience the feature-rich Hevo suite first hand. You can also have a look at the unbeatable pricing that will help you choose the right plan for your business needs.

No-code Data Pipeline for Webhooks