Shopify webhooks

From OrcaQubits/agentic-commerce-skills-plugins · View interactive version

Shopify webhooks is an AI agent skill from the GitHub repository OrcaQubits/agentic-commerce-skills-plugins. Implement Shopify webhooks — subscription methods (HTTP, EventBridge, Pub/Sub, SQS), HMAC verification, mandatory GDPR webhooks, delivery methods, retry policy, and idempotency. Use when building event-driven Shopify integrations.

How to use this skill

Skill file

Shopify Webhooks

Before writing code

Fetch live docs:

  1. Web-search site:shopify.dev webhooks for webhook overview
  2. Web-search site:shopify.dev webhook topics for available event topics
  3. Web-search site:shopify.dev gdpr mandatory webhooks for GDPR requirements

Subscription Methods

HTTP (Default)

Shopify POSTs JSON to your endpoint:

Amazon EventBridge

For AWS-based architectures:

Google Cloud Pub/Sub

For GCP-based architectures:

Amazon SQS

For queue-based processing:

HMAC Verification

Every HTTP webhook includes X-Shopify-Hmac-SHA256 header:

import crypto from 'crypto';

function verifyWebhook(body: string, hmacHeader: string, secret: string): boolean {
  const hash = crypto
    .createHmac('sha256', secret)
    .update(body, 'utf8')
    .digest('base64');
  return crypto.timingSafeEqual(
    Buffer.from(hash),
    Buffer.from(hmacHeader),
  );
}

Always verify HMAC before processing — reject unverified webhooks with 401.

Webhook Topics

Orders

orders/create, orders/updated, orders/paid, orders/fulfilled, orders/cancelled, orders/delete

Products

products/create, products/update, products/delete

Customers

customers/create, customers/update, customers/delete

Cart

carts/create, carts/update

Checkout

checkouts/create, checkouts/update

Inventory

inventory_levels/update, inventory_items/update

Fulfillments

fulfillments/create, fulfillments/update

Refunds

refunds/create

Mandatory GDPR Webhooks

Every Shopify app MUST implement these three webhooks:

  1. customers/data_request — customer requests their data (data portability)
  2. customers/redact — customer requests data deletion
  3. shop/redact — store uninstalls your app, delete all store data within 48 hours

Failure to implement these can result in app rejection or removal from the App Store.

Retry Policy

Subscribing via GraphQL

mutation WebhookSubscriptionCreate {
  webhookSubscriptionCreate(
    topic: ORDERS_CREATE
    webhookSubscription: {
      callbackUrl: "https://your-app.com/webhooks/orders"
      format: JSON
    }
  ) {
    webhookSubscription {
      id
      topic
      endpoint {
        ... on WebhookHttpEndpoint {
          callbackUrl
        }
      }
    }
    userErrors { field message }
  }
}

Best Practices

Fetch the Shopify webhook documentation for exact topic names, payload schemas, and subscription patterns before implementing.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.