概括
我一直在关注关于使用 Node 和 React 设置应用程序的 Shopify 教程。我一切正常,但我正试图越过最后一步。我正在尝试获取从 Shopify webhooks 返回的数据,但我看不到数据/有效负载的位置。
背景
我已经尝试在中间件之前和之后打印出响应和请求,但似乎没有得到任何有用的回报,只是收到如下内容:
{ method: 'POST',
url: '/webhooks/products/create',
header:
{ host: '01e9702c.ngrok.io',
'user-agent': 'Shopify-Captain-Hook',
'content-length': '1175',
accept: '*/*',
'accept-encoding': 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
'content-type': 'application/json',
'x-shopify-api-version': '2019-07',
'x-shopify-hmac-sha256': 'some value',
'x-shopify-product-id': '2018829729858',
'x-shopify-shop-domain': 'example.myshopify.com',
'x-shopify-topic': 'products/create',
connection: 'close',
'x-forwarded-proto': 'https',
'x-forwarded-for': '123.456.789' } }
router.post('/webhooks/products/create', webhook, (ctx) => {
console.log('Products webhook - create: ', ctx.state.webhook);
// Want to view product that was created here
});
router.post('/webhooks/products/delete', webhook, (ctx, x) => {
console.log('Products webhook - delete: ', ctx.state.webhook);
// Want to see product that was deleted here
});
慕标琳琳
德玛西亚99
相关分类