Topics covering webhook creation & management, event handling, Pub/Sub, and Eventbridge, in Shopify apps.
Hi,
I am trying to setup webhooks in my node.js app for product update and product delete events. So, when a merchant delete or update a product on their store in which my app is installed, i want to receive a notification on my node.js server. I have tried below.
const responseProductDeleteWebhookHandler = async (topic, shop, body) => {
try {
console.log(shop, body);
} catch (err) {
logger.error(err);
}
};
Shopify.Webhooks.Registry.webhookRegistry.push({
path: '/webhooks',
topic: 'PRODUCTS_DELETE',
webhookHandler: responseProductDeleteWebhookHandler,
});
const responseProductDelete =. await Shopify.Webhooks.Registry.register({
shop,
accessToken,
path: '/webhooks',
topic: 'PRODUCTS_DELETE',
webhookHandler: responseProductDeleteWebhookHandler,
});
But, the problem is that, when i delete or update a product on my dev store, i am not getting any notification. How do i setup a webhook to receive notifications on my server once a product is deleted/updated?