Shopify API Integrations: Complete Guide
How to build order automation, inventory sync, and 3PL integrations using Shopify REST/GraphQL APIs and webhooks.
Quick Answer
Shopify offers dual REST and GraphQL APIs for integrations. Use webhooks for async events (orders, inventory), APIs for synchronous data queries/mutations. Common integrations: 3PL fulfillment routing, ERP accounting sync, email marketing. Test webhooks with Requex before shipping to production.
Shopify API Architecture: REST vs GraphQL
Shopify provides two APIs: REST (resource-based, simpler) and GraphQL (query-based, flexible). The REST API is mature and widely documented. GraphQL is newer, optimizes queries, and handles complex bulk operations better.
REST API: Simple for CRUD operations. Request `/admin/api/2024-01/orders.json` to fetch orders. Good for straightforward integrations.
GraphQL API: Powerful for complex queries. Write a query that fetches orders with related fulfillments, line items, and inventory in one request. Better for high-volume data needs.
Five Key Integration Scenarios
1. Order & Fulfillment Automation
Capture orders/created webhook, extract fulfillment location, route to 3PL (Easyship, Kase, Fulfyld) via API. 3PL returns tracking; update Shopify fulfillment with FulfillmentOrders API.
2. Inventory Level Sync
inventory_levels/update webhook fires when stock changes. Use this to sync to WMS, prevent oversells, or alert suppliers.
3. Product Catalog Management
products/created and products/updated webhooks sync to marketing tools, pricing engines, or multi-channel platforms (Shopify→Amazon, eBay).
4. ERP & Accounting Sync
orders/fulfilled webhook triggers invoice generation in accounting system (NetSuite, Xero, QuickBooks). Line items, totals, taxes all synced.
5. Customer & Email Marketing
customers/created webhook syncs to CRM (Salesforce, HubSpot) or email platform (Klaviyo, Drip) for segmentation and campaigns.
Testing Shopify Webhooks with Requex
Before deploying your webhook handler to production, test with a temporary endpoint:
- Visit Requex.me and copy your webhook URL.
- In Shopify Admin, go to Settings → Notifications → Webhooks → Create webhook.
- Select event (e.g., "Order created"), paste Requex URL, click Create.
- Shopify provides a "Send test notification" button. Click it to see sample payload.
- Inspect the payload in Requex dashboard. Verify headers, signature, and event structure.
Requex lets you test HMAC verification, payload parsing, and error responses without a deployed server.
Common Shopify Webhook Testing Pain Points
HMAC Verification Failures
Most common error: parsing JSON body instead of using raw bytes for HMAC verification. Shopify HMAC must be computed over the exact request body before any parsing.
Fix: Use express.json({ verify: (req, res, buf) => req.rawBody = buf }) to capture raw body.
Webhook Delivery Delays & Rate Limits
Shopify waits 5 seconds for your endpoint to respond (200 status). If unresponsive, Shopify queues the webhook. During high load, delivery can pause. API rate limits (2 calls/sec) also apply.
Fix: Respond 200 immediately. Process webhook asynchronously in a queue (Bull, RabbitMQ).
API Versioning & Breaking Changes
Shopify sunsets API versions; your integration must handle version transitions. The X-Shopify-Api-Version header in webhook payloads shows which version the store is using.
Fix: Pin your integration to a specific API version. Monitor for deprecation notices.
Shopify HMAC Signature Verification
Always verify the webhook signature to ensure it came from Shopify:
// Node.js / Express example
const crypto = require('crypto');
app.post('/webhook', express.json({ verify: (req, res, buf) => {
req.rawBody = buf;
}}), (req, res) => {
const hmacHeader = req.headers['x-shopify-hmac-sha256'];
const secret = process.env.SHOPIFY_WEBHOOK_SECRET;
const hash = crypto
.createHmac('sha256', secret)
.update(req.rawBody)
.digest('base64');
if (!crypto.timingSafeEqual(Buffer.from(hmacHeader), Buffer.from(hash))) {
return res.status(401).json({ error: 'Invalid HMAC' });
}
const payload = JSON.parse(req.rawBody);
// Process webhook...
res.status(200).send('ok');
});Start Testing Webhooks Now
Generate your unique URL and test webhooks instantly. Free, no signup.
Open Webhook Tester →