Software & B2B
System integration with Shopify: API, webhooks and the failure case
An interface that works in testing is not yet a stable interface. In everyday operation, messages arrive twice, in the wrong order or not at all. Good integrations allow for this from the outset.
In short
- Shopify integrations use the Admin API for reading and writing and webhooks for immediate notification of events.
- Shopify itself states that webhook delivery is not guaranteed and that messages can arrive twice; regular reconciliation closes the gaps.
- Rate limits, API versions and access permissions belong in the planning, not just in troubleshooting.
What it is about
Behind every connection of Shopify to inventory management, ERP, shipping or accounting there is an interface. It determines whether orders arrive reliably and stock levels are correct. In a test with three orders, almost any interface works. Whether it is fit for purpose shows on the first promotion day with many orders, during a server outage or after an update.
This article is aimed at decision-makers who want to understand what makes an integration robust, and at teams that are having one built.
How it works
Shopify offers two ways of exchanging data. Via the Admin API, today mainly as a GraphQL interface, another system reads and writes products, stock levels, customers and orders. Via webhooks, Shopify actively reports events, such as "order created" or "inventory changed", to an address of your integration.
According to the Shopify documentation, webhook delivery is not guaranteed. An integration can miss events, for example if it is briefly unreachable. In addition, messages can arrive twice because of retries. Shopify recommends detecting duplicates via the identifier in the header of each message. The way out of both is regular reconciliation: at fixed intervals, the integration asks via the API whether it is missing anything.
The API limits how much an integration may query within a period of time. With GraphQL, Shopify calculates a cost per query and continuously refills a quota. For large data volumes there are bulk queries that run in the background. And Shopify regularly publishes new API versions; older ones are no longer supported after a fixed period.
Where it goes wrong
The classic case is the integration that relies on webhooks alone. If it goes down for an hour, that hour's orders are missing, and nobody notices until a customer asks.
Secondly, duplicate processing. If every message is accepted blindly, duplicate orders appear in inventory management or stock is deducted twice.
Thirdly, permissions that are too broad. An integration that only needs to read orders is given full access to all customer data. If its access key becomes known, the whole store is open.
How to proceed
Treat webhooks as a fast signal and plan an additional reconciliation. Detect duplicate messages by their identifier and make every processing step repeatable without creating duplicate data. Respond to Shopify quickly and then process the data in a queue. Plan for the rate limits, especially for the initial import of large product ranges. Keep the API version you use in the calendar and update in good time. Grant only the access permissions the integration needs, and keep access keys in a vault, never in the source code.
Read more: Connecting Shopify to your ERP system: connector, middleware or custom build, API security: the open back door of modern software and Security in your Shopify store: protecting apps, access and trade data.
How Airnite helps
With the Store–ERP Integration package, we develop interfaces with reconciliation, protection against duplicate processing, logging and monitoring, and we test the failure case before go-live. On request, we check an existing integration with a security test for overly broad permissions and open access points.
Checklist
Sources
Every fact in this article is based on the following publications. Primary sources are marked.
- Shopify Developer DocsAbout webhooks
- Shopify Developer DocsIgnore duplicate webhooks
- Shopify Developer DocsGraphQL Admin API rate limits
- Shopify Developer DocsAbout Shopify API versioning
Matching services
Read on
Connecting Shopify to your ERP system: connector, middleware or custom build
An online store without a connection to inventory management is a second warehouse on paper. Stock levels are typed in by hand, orders are entered twice. There are three ways to change this, and each costs a different amount of flexibility.Security3 minAPI security: the open back door of modern software
The website looks tidy and the login is secure. But behind the interface, an API politely answers every question, including the one about other customers' data.Security3 minSecurity in your Shopify store: protecting apps, access and trade data
"Shopify is hosted, so nothing can happen." The platform itself is well protected. The biggest risks lie where you make the decisions: who has access, which apps read data and which custom code runs in the store.Current incidents and warnings are covered in the Zero Day magazine. Go to the magazine