Get your dream built 10x faster

How to integrate Shopify with OpenClaw

We build custom applications 5x faster and cheaper 🚀

Book a Free Consultation
4.9
Clutch rating 🌟
600+
Happy partners
17+
Countries served
190+
Team members
Matt Graham, CEO of Rapid Developers

Book a call with an Expert

Stuck on an error? Book a 30-minute call with an engineer and get a direct fix + next steps. No pressure, no commitment.

How to integrate Shopify with OpenClaw

Integrate Shopify with OpenClaw by installing a Shopify skill in ClawHub, performing Shopify’s OAuth (or using a Shopify custom app token) to obtain and securely store API credentials, exposing a reliable webhook receiver outside the agent for event-driven flows, and implementing signed REST/GraphQL calls from your skill/agent to the Shopify Admin APIs. Keep long-running, stateful, and public endpoints outside the agent runtime; the agent should only call the Shopify APIs or your external services using properly-scoped tokens you manage in ClawHub or your secrets store.

 

Overview: what this integration actually requires

 

  • Install and configure the OpenClaw skill that will call Shopify via ClawHub (supply credentials in the skill configuration).
  • Create a Shopify app (public, custom, or private depending on use case) to get client_id/client_secret or a custom app access token.
  • Perform Shopify OAuth to obtain an access token (or use the app’s admin-generated token for a custom/private app), and persist that token in a secure store (ClawHub secrets or your external secret manager).
  • Host webhook endpoints and any stateful services outside the agent (web server or serverless function) to receive Shopify webhooks and to handle token exchange callbacks.
  • Call Shopify REST or GraphQL Admin APIs from the agent/skill using the stored token and validate webhook signatures on incoming requests.

 

Step-by-step integration

 

  • Create the Shopify app
    • In the Shopify Admin (or Partner Dashboard for public apps), create an app and configure the OAuth redirect URL (point it at a handler you control — either an external service that exchanges codes or a ClawHub-provided auth callback if present and documented).
    • Decide scopes you need (read_products, write_orders, etc.) and list them in the app configuration.
  • Implement the OAuth flow or provision a token
    • For OAuth: send the merchant to the Shopify authorization URL, then exchange the code for an access token at Shopify’s token endpoint. Store the returned access\_token securely.
    • For custom apps: you may get a static admin access token from Shopify admin — store it securely as well.
  • Store credentials securely
    • Put the access token, client\_secret, and any API keys into ClawHub’s secure configuration for the skill, or into an external secret store you mount or reference at runtime. Do not hardcode secrets in skill code.
  • Host webhook receivers externally
    • Shopify will send webhooks to an HTTPS endpoint you specify. Host that endpoint in a web server or serverless function (outside the agent) and validate HMAC signatures before processing.
    • After validating the webhook, your external service can call the OpenClaw agent skill (if needed) via the skill’s API to perform agent-driven tasks, or it can store events/queue them for later processing.
  • Call Shopify APIs from the skill
    • Make authenticated REST or GraphQL calls using the stored token. Handle API errors, rate limits and retries.

 

OAuth exchange (concrete, generic REST example)

 

Merchant authorization:

# <b>//</b> Direct merchant to this URL (replace placeholders)
# <b>//</b> GET https://{shop}.myshopify.com/admin/oauth/authorize?client_id={client_id}&scope={scopes}&redirect_uri={redirect_uri}

Exchange code for token (server-side):

curl -X POST "https://{shop}.myshopify.com/admin/oauth/access_token" \
  -H "Content-Type: application/json" \
  -d '{
    "client_id":"YOUR_CLIENT_ID",
    "client_secret":"YOUR_CLIENT_SECRET",
    "code":"AUTHORIZATION_CODE"
  }'

Response contains an access\_token you must store securely.

 

Calling Shopify Admin REST API (example)

 

curl -X GET "https://{shop}.myshopify.com/admin/api/2023-10/products.json" \
  -H "X-Shopify-Access-Token: YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json"

Or GraphQL (POST), using the same header or the documented GraphQL header for the API you call.

 

Webhooks: registration and signature verification

 

  • Register webhooks
    • You can register webhooks either through the Shopify admin UI or programmatically with the Admin API (POST to /admin/api//webhooks.json).
  • Validate incoming webhooks
    • Shopify signs webhook payloads with HMAC-SHA256 using your app secret and places the signature in the X-Shopify-Hmac-Sha256 header (base64).
    • Compute HMAC of the raw request body using the app secret and compare in constant time to the header value before processing.

 

Webhook verification example (Node.js/Express)

 

// <b>//</b> Example Express middleware to verify Shopify webhook HMAC
const crypto = require('crypto');

// <b>//</b> Keep raw body for HMAC verification
app.use(express.json({
  verify: (req, res, buf) => { req.rawBody = buf; }
}));

function verifyShopifyWebhook(req, res, next) {
  const hmacHeader = req.get('X-Shopify-Hmac-Sha256');
  const secret = process.env.SHOPIFY_CLIENT_SECRET; // <b>//</b> stored securely
  const computed = crypto.createHmac('sha256', secret).update(req.rawBody).digest('base64');

  // <b>//</b> constant-time compare
  if (!crypto.timingSafeEqual(Buffer.from(computed), Buffer.from(hmacHeader))) {
    return res.status(401).send('Invalid HMAC');
  }
  next();
}

app.post('/webhook/orders/create', verifyShopifyWebhook, (req, res) => {
  // <b>//</b> process webhook: queue event, call agent, etc.
  res.status(200).send('OK');
});

 

Architecture: what runs where (explicitly)

 

  • External services (must be outside agent):
    • Webhook receivers (HTTPS endpoints), because they need a stable public URL and uptime.
    • OAuth callback handlers that exchange codes for tokens and persist tokens to a secret store.
    • Stateful storage (databases), job queues, schedulers, and other persistent infrastructure for reliability and scaling.
  • Agent/skill code (runs inside OpenClaw agent process):
    • Short-lived calls to Shopify APIs using stored credentials.
    • Orchestration logic that maps Shopify events to skill actions, provided authentication and secrets are configured in ClawHub.
    • No publicly-exposed webhook endpoint should be hosted inside a transient agent runtime unless OpenClaw/ClawHub explicitly provides documented stable endpoints for that purpose.

 

Secrets, tokens, and scopes

 

  • Store the Shopify access_token and client_secret in a secrets store or ClawHub skill configuration (documented secure field) — never in code or logs.
  • Request the minimum scopes needed. Test with the exact scopes; Shopify will reject calls outside granted scopes.
  • Confirm whether the token is offline (long-lived) or online (short-lived) and implement refresh behavior if needed. Check Shopify docs for token lifetimes and refresh flows for your app type.

 

Retries, rate limits and error handling

 

  • Shopify uses API rate limiting. Detect 429 or 503 responses, back off, and retry with exponential backoff.
  • Log API responses and errors (status codes and response bodies) so you can diagnose scope or permission issues.
  • Implement idempotency where appropriate (for webhooks and order processing) to handle retries safely.

 

Debugging checklist

 

  • Confirm the access token you are using is valid: make a simple GET /products or /shop call and inspect the response; if 401/403, inspect the token and scopes.
  • If webhooks are not arriving, verify the webhook URL is reachable externally and that Shopify shows the webhook as “active” in the app admin or API response.
  • If webhook payloads are rejected, check signature verification: use the raw request body when computing HMAC and ensure you use the correct app secret.
  • Check logs in your external webhook server and your skill runtime (ClawHub logs) to confirm the skill is being invoked and credentials are loaded.
  • Inspect API responses and error bodies — Shopify provides JSON error details that indicate missing scopes, throttling, or malformed requests.

 

Example flow tying it together

 

  • Merchant installs app → Shopify redirects to your OAuth callback (hosted externally) → callback exchanges code for token → you store token in secrets and register webhooks (or prompt Shopify to use admin-registered webhooks).
  • Shopify sends an order/create webhook → your external webhook endpoint validates HMAC and enqueues an event → a worker or the OpenClaw agent consumes the event and makes authorized calls to Shopify (e.g., update order, read product) using the stored token.

 

Notes on being explicit (no magic)

 

  • Everything must be configured explicitly: OAuth redirect URIs, tokens, webhook addresses, scopes, environment variables, and secret storage.
  • The OpenClaw agent does not magically create tokens or public endpoints — you must perform OAuth flows and host endpoints yourself or use documented ClawHub features for auth and secrets if available.
  • If ClawHub provides documented helpers (SDKs, callbacks, secret fields), use those. If not, implement the OAuth and webhook receivers as external services and reference secrets from the skill configuration.

Book Your Free 30‑Minute Migration Call

Speak one‑on‑one with a senior engineer about your no‑code app, migration goals, and budget. In just half an hour you’ll leave with clear, actionable next steps—no strings attached.

Book a Free Consultation

Troubleshooting Shopify and OpenClaw Integration

1

Why does OpenClaw webhook signature validation fail for Shopify X-Shopify-Hmac-Sha256 header?

 

Direct Answer

 

The webhook signature fails when the HMAC Shopify sends (in X-Shopify-Hmac-Sha256) doesn’t match the HMAC you compute—usually because the raw request body was altered (JSON parsed or normalized), the wrong secret is used, you compare base64 vs hex, or you don’t use a constant-time compare.

 

Details and checklist

 
  • Use the raw body bytes — middleware that parses JSON will change bytes.
  • Use the webhook shared secret — not an API key or app id.
  • Base64 encode the HMAC-SHA256 digest (Shopify uses base64).
  • Use timing-safe compare to avoid false negatives.

const crypto = require('crypto');
function verifyShopify(bodyRaw, secret, header) {
const hmac = crypto.createHmac('sha256', secret).update(bodyRaw, 'utf8').digest('base64');
return crypto.timingSafeEqual(Buffer.from(hmac), Buffer.from(header));
}
module.exports = { verifyShopify };

2

Why does the OpenClaw Connector return 401 Unauthorized when calling the Shopify Admin API with the store access token?

A 401 Unauthorized means Shopify rejected the credential the OpenClaw Connector sent. In practice that’s almost always an invalid/expired/revoked token, the wrong token type (storefront vs admin), a bad header or endpoint, or the Connector isn’t loading the correct environment variable/secret before the skill call.

 

What to check

 
  • Token type: use the Admin access token, not a storefront token.
  • Header: Shopify expects X-Shopify-Access-Token for Admin API (not always Authorization: Bearer).
  • Env/config: verify ClawHub/skill env var contains the right token and is used by the Connector.
  • Scopes/expiry: ensure token wasn’t revoked and has required scopes.

 

Example

 
fetch('https://your-store.myshopify.com/admin/api/2023-10/shop.json', {
  method: 'GET',
  headers: {
    // X-Shopify-Access-Token must be the Admin access token
    'X-Shopify-Access-Token': process.env.SHOPIFY_ADMIN_TOKEN
  }
})

3

Why are Shopify product variants not mapping to OpenClaw SKU fields in the Claw Mapping Profile during a Sync Job?

Direct answer: The common causes are that the Claw Mapping Profile is pointing at the product-level SKU field while Shopify stores SKUs on variants, the Sync Job is not configured to iterate or expand variants, or the Shopify API/credentials return variant objects without a populated sku field. Verify mapping targets, job settings, and the API response.

 

Diagnostics and fixes

 

Check the raw Shopify API payload in logs to confirm where SKU appears (product.sku vs variant.sku). Ensure the Sync Job is configured to process variant records (or map a variant collection to the OpenClaw SKU field). Confirm OAuth/API token has read_products scope so variants are returned, and that variant.sku values aren’t empty. Update the Claw Mapping Profile to reference the correct JSON path or iterate variants, then re-run a single-product sync and inspect mapping errors in the job log.

4

Why does OpenClaw Inventory Sync show incorrect stock quantities after Shopify order fulfillment and how to reconcile inventory?

OpenClaw shows wrong stock after Shopify fulfillment when the runtime missed or misapplied Shopify events (webhook delivery failures, permission/auth issues, wrong location/SKU mapping, or race conditions). Reconcile by re-reading Shopify’s authoritative inventory, applying idempotent updates to the OpenClaw skill’s datastore (or external DB), and repairing missed events.

 

Reconciliation checklist

 
  • Check webhook delivery & HMAC — replay failed deliveries from Shopify.
  • Verify permissions — ensure the skill has inventory read/write scopes.
  • Map locations/SKUs — align Shopify locations to skill IDs.
  • Fetch authoritative levels — call Shopify inventory endpoints and compute deltas.
  • Idempotent updates — use last-write-wins or sequence tokens to apply fixes.
  • Run periodic full sync and log+alert for mismatches; move state out of runtime for reliability.
Book a Free Consultation

Still stuck?
Copy this prompt into ChatGPT and get a clear, personalized explanation.

This prompt helps an AI assistant understand your setup and guide you through the fix step by step, without assuming technical knowledge.

AI AI Prompt


Recognized by the best

Trusted by 600+ businesses globally

From startups to enterprises and everything in between, see for yourself our incredible impact.

RapidDev was an exceptional project management organization and the best development collaborators I've had the pleasure of working with.

They do complex work on extremely fast timelines and effectively manage the testing and pre-launch process to deliver the best possible product. I'm extremely impressed with their execution ability.

Arkady
CPO, Praction
Working with Matt was comparable to having another co-founder on the team, but without the commitment or cost.

He has a strategic mindset and willing to change the scope of the project in real time based on the needs of the client. A true strategic thought partner!

Donald Muir
Co-Founder, Arc
RapidDev are 10/10, excellent communicators - the best I've ever encountered in the tech dev space.

They always go the extra mile, they genuinely care, they respond quickly, they're flexible, adaptable and their enthusiasm is amazing.

Mat Westergreen-Thorne
Co-CEO, Grantify
RapidDev is an excellent developer for custom-code solutions.

We’ve had great success since launching the platform in November 2023. In a few months, we’ve gained over 1,000 new active users. We’ve also secured several dozen bookings on the platform and seen about 70% new user month-over-month growth since the launch.

Emmanuel Brown
Co-Founder, Church Real Estate Marketplace
Matt’s dedication to executing our vision and his commitment to the project deadline were impressive. 

This was such a specific project, and Matt really delivered. We worked with a really fast turnaround, and he always delivered. The site was a perfect prop for us!

Samantha Fekete
Production Manager, Media Production Company
The pSEO strategy executed by RapidDev is clearly driving meaningful results.

Working with RapidDev has delivered measurable, year-over-year growth. Comparing the same period, clicks increased by 129%, impressions grew by 196%, and average position improved by 14.6%. Most importantly, qualified contact form submissions rose 350%, excluding spam.

Appreciation as well to Matt Graham for championing the collaboration!

Michael W. Hammond
Principal Owner, OCD Tech

We put the rapid in RapidDev

Need a dedicated strategic tech and growth partner? Discover what RapidDev can do for your business! Book a call with our team to schedule a free, no-obligation consultation. We’ll discuss your project and provide a custom quote at no cost.Â