Skip to content

What is a webhook and how to use one

Written by

Last editedApr 20232 min read

We’re all looking for ways to make our websites more efficient while providing better customer service, and automation holds the key to faster, smarter processes. One aspect of API growing in popularity is a webhook, which breaks down online actions into events and reactions. If you’re wondering what a webhook is and how to use it, find out more below.

What is a webhook?

Before we can dive into how to use webhooks, we must first answer the basic question: what is a webhook, anyway? You might also see this concept referred to as an HTTP push API or web callback, but the webhook meaning remains the same no matter its title. A webhook provides a way for your app to provide other apps with real-time data.

With a traditional API, you can access this same data. The difference is that you’ll need to proactively request it, whereas a webhook delivers this information automatically and in real-time. This ensures a faster automated response to any action that a customer takes on your website, whether it’s changing payment details or signing up for a new subscription. 

How do webhooks work?

A webhook is a small sequence of code linked to your web application. They’re fully adaptable by the user and designed to be triggered by a specific event. When looking at how to use a webhook, you might notice that they seem to work in reverse to a typical API. You essentially need to design a specific API that your webhook can use.

There are two main parties delivering information when setting up a webhook. The first is the webhook provider, which is a third-party app or website. When a predetermined event takes place on your website or app, the provider sends the webhook to your URL. The webhook serves as a signal for your app to perform a predetermined action in response to the predetermined event. The main thing to remember is that while API calls are based on a request, webhooks are triggered by an event.

Real-world examples of the webhook meaning

To better understand how to use webhooks, let’s turn to some real-world examples.

  • Shopify provides users with webhooks to send alerts for events including updated carts, new checkouts, payments, refunds, and product changes. This means ecommerce store owners won’t miss any important orders.

  • MailChimp uses webhooks to send alerts for new events including profile updates, subscribes, and unsubscribes. This means if someone changes their email address, you’ll be alerted by the webhook to update your subscriber list accordingly.

  • GoCardless sends webhooks to your server to enable real-time notifications of important events including payment failures or new recurring payments. This allows you to take automated actions accordingly and keep your payments system flowing smoothly.

How to use a webhook

You can see from the examples of the webhook meaning above how this system can be put to good use. Essentially, you can use a webhook for purposes including the following:

  • Notification that the event has taken place

  • Customize your web applications to better suit client needs

  • Syncing real-time data across multiple online applications

  • Form a connection between multiple applications

Here are the steps to follow when setting up your own webhooks:

  1. Provide a URL to the webhook provider where requests should be delivered.

  2. Trigger the webhook to test its response to the predetermined event. 

  3. Make sure your webhook is secure with an https connection and unique token.

The beauty of using webhooks is that you can fully customize them to best suit your website applications. To get started with receiving webhooks with GoCardless, simply add your webhook endpoint from your central Dashboard and follow the prompts when asked.

We can help

GoCardless helps you automate payment collection, cutting down on the amount of admin your team needs to deal with when chasing invoices. Find out how GoCardless can help you with ad hoc payments or recurring payments.

Over 85,000 businesses use GoCardless to get paid on time. Learn more about how you can improve payment processing at your business today.

Get StartedLearn More
Interested in automating the way you get paid? GoCardless can help
Interested in automating the way you get paid? GoCardless can help

Interested in automating the way you get paid? GoCardless can help

Contact sales

Try a better way to collect payments, with GoCardless. It's free to get started.

Try a better way to collect payments

Learn moreSign up