Author picture Eric Tran

How to Exclude Shopify Webhooks Using a Filter

Published


When you subscribe to a topic, Shopify will send a webhook for every event. This can lead to you receiving lots of webhooks that are not useful for your server or workflow.

In this article, I explain how to reduce the number of Shopify webhooks by applying a conditional logic using the Hookdeck filter feature.

Reduce server resource consumption to process webhooks

Imagine you have a workflow for sold-out that only triggers when a product inventory reaches 0, but in order to know the inventory, it has to parse through the hundreds, thousands, or millions of webhook events that are NOT inventory = 0. The same logic applies to receiving a webhook for every product, order, and shipping update.

This happens because the webhook sender doesn’t know which webhook is important to you, so they send a webhook for every event in case you need it (which is a good thing).

However, your server ends up overconsuming resources to go through every webhook and identify which webhook should trigger the integration. How can you reduce your server utilization to parse through every webhook?

Filter webhooks with Hookdeck

With Hookdeck, you can write JSON to add conditional logic using the filter feature.

Steps

  1. Edit your Connection.
  2. Add a Filter rule.
  3. Write and test your filter in the Dashboard.

Add your filter using the API. Read docs here.

  1. Save your Connection.

Example: How to add a filter for inventory level

Conclusion

In just 4 short steps, we’ve managed to add a filter that reduces the number of webhooks your server will be processing.