What are BigCommerce Webhooks?

What are BigCommerce Webhooks?

Much of BigCommerce's functionality comes from powerful integrations with third-party apps and services.

These third-party applications perform actions based on changes that happen in the BigCommerce store. For example, when a customer creates an order, Twilio sends them a text message.

Webhooks make these integrations possible.

BigCommerce Webhooks is an API concept that notifies applications when changes happen in a BigCommerce store. Webhooks make it easier for developers to build applications to integrate with BigCommerce. For merchants, the most visible outcome of Webhooks is faster, more robust integrations with third-party apps.

As a merchant on BigCommerce, it's important to get a basic understanding of webhooks because they can save a lot of time and money.

Benefits of Webhooks

The primary benefit of using Webhooks in BigCommerce is the ability to build applications that enhance the functionality of a store.

Instead of having to constantly call BigCommerce's API to check for updates, a developer can use a Webhook that will notify the application when a change happens.

The concept of constantly calling an API to check for updates is called polling. Polling can be a very expensive and time-consuming process, especially when that API hosts thousands of stores.

The following table describes the difference between webhooks and polling:

Without Webhooks With Webhooks
- Hey BigCommerce, did order #32 ship?"
- Hey Third-Party, no — not yet.
- BigCommerce, did order #32 ship?
- Third-Party, no — not yet.
- Hey Third-Party, order #32 shipped.
- Hey BigCommerce, thanks for letting me know!

Webhooks make communication more efficient by reducing the amount of chatter between two systems.

Webhooks can also help merchants save money by not overloading the API. Using Webhooks, a developer can monitor specific events on an app and only make API calls when something changes.

How do Webhooks work?

A Webhook is an HTTP callback that BigCommerce sends to a URL of your choice when certain events happen in your store.

Developers let BigCommerce know which events to monitor and the URL to send Webhooks to. When BigCommerce detects that one of those events has happened, it will send a JSON payload to the URL.

Illustration of the "order shipped" webhook.

Supported Webhooks

BigCommerce currently supports the following Webhooks:

  • Cart - created, updated, deleted, applied coupon, abandoned, converted
  • Category created, updated, deleted
  • Channel - created, updated
  • Customer - created, updated, deleted
  • Customer Address - created, updated, deleted
  • Customer Payment method - updated
  • Order - created, updated, archived, changed status
  • Transaction - created, updated
  • Product - created, updated, deleted, inventory changed
  • Shipment - created, updated, deleted

As you can see, the capabilities of webhooks are quite extensive and will continue to expand as BigCommerce adds new features.

How to create a Webhook?

Once you have your backend endpoint setup, you can register a webhook in BigCommerce.

To create a BigCommerce webhook, submit an HTTP POST request to the /hooks endpoint.

The request body must contain JSON with following fields:

  • scope - the event we want to subscribe to
  • destination the URL that BigCommerce will call when the event happens
  • is_active - whether the webhook is active
  • headers custom headers for validation

For example:

json
{
  "headers": {},
  "scope": "/store/order/created",
  "destination": "https://",
  "is_active": true
}

Security

If you don't secure your webhook, an intruder can pretend to be BigCommerce and send a payload to your endpoint.

Headers

To prevent attacks, we can use the headers mentioned in the previous section on calls to webhooks. Headers can contain authorization tokens that your backend can verify.

TLS-encryption

The connection between BigCommerce and your callback uses TLS-encryption. TLS-encryption ensures that nobody can intercept the connection. Preventing interceptions is crucial because the payloads can contain sensitive customer information.

Downsides

The biggest downside with webhooks is maintaining the server. BigCommerce expects your endpoint to always be available. Otherwise, you could miss an event. Short server downtime can cause a snowball effect.

BigCommerce expects the 200 HTTP code on response to calls to your endpoint.

If something goes wrong, BigCommerce will retry up to 11 times in two days. If it still doesn't get the 200 response, it deactivates the webhook.

Another risk associated with webhooks is that they can trigger a flood of requests to your server. If you have a legacy system, it might not handle the high traffic from BigCommerce's servers.

All of this means that you need to hire a development team that knows how to manage webhooks for your business. The cost of developing BigCommerce webhooks integrations can be high because there is a lot of development knowledge needed.

Webhooks vs Headless

Headless BigCommerce and webhooks both rely on APIs. But the main difference between headless BigCommerce and webhooks is that headless separates the front-end from the back-end, while webhooks are more focused towards talking to external systems.

Stores often combine webhooks with the headless implementation, but they are not the same. Many monoliths use webhooks though BigCommerce connectors with third-parties.

Conclusion

Webhooks are crucial for BigCommerce integrations.

As a merchant, you can leverage BigCommerce's webhooks and headless BigCommerce to improve business processes. For example, you can update your ERP system or trigger a third-party email marketing platform.

Getting a good understanding of webhooks and what they can do will give you ideas on how you can automate your business.

Webhooks can be a great way to improve your business. But you need to think about the downsides before you invest in them. For example, if you can't maintain the server and it goes down, this could cause major problems for your customers.

Developers who know how to manage webhooks can save you a lot of money and make your life much easier.

FAQ

Why is it important to integrate BigCommerce with an ERP?

Entering orders into your ERP is time-consuming. It also requires you to have staff who are trained in entering orders.

Integrating BigCommerce with your ERP means orders are automatically transferred the moment they are placed on the website. This avoids double work and errors caused by manual data entry.

BigCommerce offers webhooks that allow your ERP to receive real-time order updates.

How can webhooks improve my business?

Webhooks help you automate your business.

For example, if you use a third-party marketing platform like Mailchimp, integrating with BigCommerce means you can create a new email campaign as soon as the customer creates an account.

What are the risks of using webhooks?

The biggest risk of webhooks is your server. If your endpoint goes down, you could miss events. Managing the callback server requires expert knowledge. For many merchants, the cost of development is too high.

Do I need to have my server?

If you are looking to use an existing app from the BigCommerce app store, you don't need to have your server.

But if you are looking to develop a solution from scratch, you will need to have your server. A custom solution will give you more flexibility, but it also means you will need to manage the server and pay for hosting.

What is a trigger?

A trigger is an event that fires when something changes in BigCommerce. For example, "order created" is an event.

Some of the most common triggers are "order created", order updated" and "cart updated".

What are headers used for in webhooks?

Headers are authentication tokens that are used to verify that BigCommerce's requests are legitimate.

Here are some good practices to consider when using webhooks for BigCommerce:

  • Only use secure HTTPS connections.
  • Ensure that you have a strong authentication process in place.
  • Check the headers in incoming requests to prevent attacks.
Free Software Developer Career Guide

In just 7 actionable steps you can sharpen your career.

I've used these principles to increase my earnings by 63% in two years. So can you.

Published on