shopify-webhook-topic
/shopify-webhook-topic
Add or change handling of a Shopify webhook topic in Order Hub (orders/*, customers/*, refunds/*, products/*, compliance topics). Use when the user asks to "handle a new webhook", "subscribe to X", "process refunds/create", or changes how a webhook payload is stored.
- Author
- fsemilia ↗
- Repository
- order-hub ↗
- Licence
- MIT
- Last repository change
- 12.11.2026
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 12.11.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Add or change handling of a Shopify webhook topic in Order Hub (orders/*, customers/*, refunds/*, products/*, compliance topics). Use when the user asks to "handle a new webhook", "subscribe to X", "process refunds/create", or changes how a webhook payload is stored.
Triggers from the description
Original author description
Add or change handling of a Shopify webhook topic in Order Hub (orders/*, customers/*, refunds/*, products/*, compliance topics). Use when the user asks to "handle a new webhook", "subscribe to X", "process refunds/create", or changes how a webhook payload is stored.
How it works
- Steps
- Response codes (do not change without an ADR)
SKILL.md preview
---
name: shopify-webhook-topic
description: Add or change handling of a Shopify webhook topic in Order Hub (orders/*, customers/*, refunds/*, products/*, compliance topics). Use when the user asks to "handle a new webhook", "subscribe to X", "process refunds/create", or changes how a webhook payload is stored.
---
# Adding a Shopify webhook topic
The pipeline lives in `lib/shopify/webhooks.ts` (`handleShopifyWebhook`). Never bypass it: it owns
HMAC verification, the idempotency log and the transaction. A new topic is a handler, not a new route.
## Steps
1. **Check the payload shape** before writing code. Use the Shopify Dev MCP (`shopify-dev-mcp`
server in `.mcp.json`) to read the webhook reference for the topic and the API version pinned in
`shopify.app.toml` (`[webhooks] api_version`). Do not guess field names.
2. **Schema** — add a Zod schema in `lib/shopify/schemas.ts`:
- IDs: `shopifyId` helper (number|string → string).
- Money: `money` helper (decimal _string_). Never `z.number()` for prices.
- Dates: `isoDate` helper.
- Only the fields we use; unknown fields are stripped.
3. **Domain function** in `lib/shopify/ingest.ts` taking `(tx: Prisma.TransactionClient, parsed)`:
- Must be idempotent (upsert by `shopifyId`, never blind `create`).
- Respect the stale guard pattern (`shopifyUpdatedAt`) for resources that have `updated_at`.
- If it changes orders, call `recomputeCustomerAggregates(tx, customerId)` in the same tx.
- Never resurrect PII of a customer with `redactedAt` set.
4. **Register** the topic in `HANDLERS` (`lib/shopify/webhooks.ts`).
5. **Subscribe** in `shopify.app.toml` under `[[webhooks.subscriptions]]`.
6. **Fixture** in `tests/fixtures/<topic>.json` with realistic, _13-digit_ IDs (JSON.parse loses
precision above 2^53 — Shopify IDs fit, invented 18-digit ones do not).
7. **Tests** in `tests/integration/shopify-webhook.test.ts` using the `deliver()` helper. Minimum:
happy path, duplicate delivery (same webhook id), invalid payload → 422 with nothing written,
and out-of-order delivery if the resource has `updated_at`.
8. Run `npm run test:integration` (needs `npm run db:test:start`) and `npm run check`.
9. Manual check: `npm run webhook:send -- --topic <topic> --fixture tests/fixtures/<topic>.json`.
## Response codes (do not change without an ADR)
| Situation | Status | Why |
| -------------------- | ---------------------- | ------------------------------- |
| Bad HMAC | 401 | not from Shopify |
| Duplicate webhook id | 200 `{duplicate:true}` | stop Shopify retries |
| Invalid payload | 422, rolled back | logged; fixable then replayable |
| Unknown topic | 200 `{ignored}` | avoid retry storms |
| Anything else | throw → 500 | Shopify retries with backoff |
Versions
The database has no other skills named shopify-webhook-topic.
Database snapshot: 13.11.2026 · package version ef776d121905 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 1 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100shopify-webhooks-events
Register and handle Shopify webhooks including mandatory GDPR compliance topics. Use when setting up webhook subscriptions, handling order/product events, or implementing the required GDPR webhooks for app store submission. Trigger with phrases like "shopify webhook", "shopify… - 100shopify-webhooks
Receive and verify Shopify webhooks. Use when setting up Shopify webhook handlers, debugging signature verification, or handling store events like orders/create, products/update, or customers/create. - 100shopify-orders
Manage Shopify orders — order lifecycle, FulfillmentOrder model, returns and refunds, draft orders, order editing, transactions, metafields, and risk analysis. Use when working with Shopify order processing. - 100shopify-core-workflow-b
Manage Shopify orders, customers, and fulfillments using the GraphQL Admin API. Use when querying orders, processing fulfillments, managing customers, or building order management integrations. Trigger with phrases like "shopify orders", "shopify customers", "shopify… - 96shopify
Use when the user asks to build Shopify apps, themes, or extensions. - 100shopify
Use when user references Shopify, *.myshopify.com URLs, admin.shopify.com links, or asks to query/mutate products/orders/customers/inventory/draft-orders via Admin GraphQL. Multi-store and multi-app via SHOPIFY_PROFILE.