Prompt
receive shopify webhook event
Latest observation
Oct 16, 2026
OpenAI APIWeb search: off
To receive a Shopify webhook event, you need:
- An HTTPS endpoint in your app/server
- A webhook subscription in Shopify pointing to that endpoint
- Verification of Shopify’s HMAC signature when the request arrives
Example flow
1) Create an endpoint
Your app should expose something like:
POST /webhooks/orders/create
Shopify will send the webhook as a POST with JSON body.
2) Verify the webhook
Shopify includes an X-Shopify-Hmac-Sha256 header.
You must compute the HMAC of the raw request body using your app’s Shopify API secret and compare it.
3) Respond quickly
Return 200 OK as soon as possible.
If Shopify doesn’t get a fast 2xx response, it may retry.
Example in Node.js / Express
import express from "express";
import crypto from "crypto";
const app = express();
// IMPORTANT: use raw body for webhook verification
app.post("/webhooks/orders-create", express.raw({ type: "application/json" }), (req, res) => {
const hmacHeader = req.get("X-Shopify-Hmac-Sha256");
const secret = process.env.SHOPIFY_API_SECRET;
const generatedHmac = crypto
.createHmac("sha256", secret)
.update(req.body, "utf8")
.digest("base64");
if (generatedHmac !== hmacHeader) {
return res.status(401).send("Unauthorized");
}
const payload = JSON.parse(req.body.toString("utf8"));
console.log("Webhook received:", payload);
return res.status(200).send("OK");
});
app.listen(3000, () => console.log("Listening on port 3000"));
Register the webhook in Shopify
REST Admin API example
POST /admin/api/2024-07/webhooks.json
{
"webhook": {
"topic": "orders/create",
"address": "https://your-domain.com/webhooks/orders-create",
"format": "json"
}
}
GraphQL example
Use the webhookSubscriptionCreate mutation.
Required headers Shopify sends
X-Shopify-TopicX-Shopify-Shop-DomainX-Shopify-Hmac-Sha256X-Shopify-Webhook-IdX-Shopify-Api-Version
Important notes
- Your endpoint must be publicly reachable over HTTPS
- Use the raw body for HMAC validation
- Don’t parse JSON before verification
- Make webhook handling idempotent because retries can happen
If you want, I can also give you:
- a Python Flask example
- a Node.js with NestJS example
- a Shopify App Remix example
- a test webhook receiver you can run locally