Webhooks
Subscribe to real-time store events and verify Standard Webhooks signatures.
devhelp shop delivers real-time store events to HTTPS endpoints you configure in Settings → Webhooks (or programmatically via admin.webhooks.create).
Wire format (Standard Webhooks)
Deliveries follow the Standard Webhooks specification, so you can verify requests with @devhelp/shop/webhooks or any Standard Webhooks library in Python, Go, Ruby, PHP, Java, or Node.
Every delivery includes three headers:
| Header | Description |
|---|---|
webhook-id | Unique event ID — use this to deduplicate deliveries. |
webhook-timestamp | Unix timestamp in seconds when the delivery was signed. |
webhook-signature | v1,<base64 HMAC-SHA256 of "${id}.${timestamp}.${body}"> (space-separated signatures during secret rotation). |
Verifying with @devhelp/shop/webhooks
@devhelp/shop/webhooks uses Web Crypto with zero Node-only dependencies, so it works in Next.js Route Handlers, Node servers, and Cloudflare Workers:
import {
verifyWebhook,
WebhookVerificationError,
} from "@devhelp/shop/webhooks";
export async function POST(request: Request) {
const body = await request.text();
try {
const event = await verifyWebhook({
body,
headers: request.headers,
secret: process.env.DEVHELP_WEBHOOK_SECRET!,
});
switch (event.type) {
case "order.placed":
// Handle new order
break;
case "fulfillment.rto":
// Handle return-to-origin
break;
}
return new Response("ok", { status: 200 });
} catch (error) {
if (error instanceof WebhookVerificationError) {
return new Response("Invalid signature", { status: 401 });
}
throw error;
}
}Endpoint requirements
- URLs must use HTTPS and must not resolve to private or internal IP addresses.
- Respond with a
2xxstatus code within the timeout window. - Deliveries are at-least-once and unordered. Always store processed
webhook-idvalues and handle retries idempotently.
Retries, secret rotation, and delivery logs
- Retries: Non-
2xxresponses or timeouts are retried with backoff. Every attempt's status code, duration, error, and first 2 KB of response body are visible in Settings → Webhooks and viaadmin.webhooksdelivery endpoints. - Auto-disable: Endpoints that fail continuously for a full day are automatically disabled with a
disabledReason. Re-enable them once your receiver is healthy. - Zero-downtime secret rotation: Rotating a signing secret issues a new
whsec_…secret while continuing to include signatures from the previous secret untilpreviousSecretExpiresAtpasses.
See the complete, auto-generated list of subscribable events in Webhook Topics Reference.