New app guidance

I'm building a Shopify app for dropshipping that syncs products and inventory between two types of stores: a supplier store and one or more purchaser stores. Product Sync: This will be a one-way sync from the supplier to the purchaser (i.e., products and details are copied from the supplier to the purchaser). Inventory Sync: This needs to be a two-way sync — whenever inventory is updated on either the supplier or purchaser side, a webhook is triggered to update the other side accordingly. The Problem: If a supplier store is connected to many purchaser stores (e.g., 100), a single sale on one purchaser store could trigger a cascade of webhook updates: 1. A sale happens on one purchaser store. 2. Its inventory is updated. 3. The supplier's inventory is then decremented via webhook. 4. That change triggers inventory updates across all other purchaser stores synced to the supplier. 5. This could potentially result in hundreds of webhook calls for a single sale. My Question: What is the best architectural or design approach to handle this efficiently and avoid unnecessary webhook loops or performance issues? I'm especially concerned about redundant updates, rate limits, and preventing circular or repeated webhook triggering.
1 Reply
Smelvin
Smelvin2mo ago
Hi Safwan, I would reccomend checking out webhook filters for your concern. I have a link here for our documentation on them https://docs.gadget.dev/guides/plugins/shopify/shopify-webhooks#webhook-filters

Did you find this page helpful?