Great question — answering as the UphillTech team:
You are using KOA middlewares but my answer will be without koa hope it helps. 1. Install shopify module for node npm install --save shopify-api-node 2. First Creation Of Webhook shopify.service.ts const shopify = new Shopify({ shopName: shop_name, accessToken: access_token, }); // Create Webhook await shopify.webhook.create({ topic: 'YOUR_WEBHOOK_EVENT', format: 'json', address: 'YOUR_URL_FOR_WEBHOOK', }); 3. Receving Webhooks 3.1 In you main.ts use the bodyparser like this app.use( json({ verify: (req: any, res, buf, encoding) => { if (req.headers['x-shopify-hmac-sha256']) { req.rawBody = buf.toString(encoding || 'utf8'); } return true; }, }), ); 3.2 In your controller import * as crypto...
Full answer by iamsr: https://stackoverflow.stackexchange.com/a/67672740 (CC BY-SA 4.0).
Need it done for your business? UphillTech.