Topics covering webhook creation & management, event handling, Pub/Sub, and Eventbridge, in Shopify apps.
Hello,
I've added 3 webhoks in my app settings
https://host/webhooks/customers/data_request
https://host/webhooks/customers/redact
https://host/webhooks/shop/redact
In my node.js app i'm trying to register these webhooks, but i've got an error:
const customersRedactWebhookRegistration = await registerWebhook({ address: `${HOST}/webhooks/customers/redact`, topic: 'CUSTOMERS_REDACT', accessToken, shop, }); if (customersRedactWebhookRegistration.success) { console.log('Successfully registered customers redact webhook!'); } else { console.log('Failed to register customers redact webhook', customersRedactWebhookRegistration.result); }
message: "Argument 'topic' on Field 'webhookSubscriptionCreate' has an invalid value. Expected type 'WebhookSubscriptionTopic!'.",
Which topic should i set for these hooks?
Hi @davydovct
The available topics are listed here: https://help.shopify.com/en/api/reference/events/webhook
Hey @davydovct,
Once you register the webhooks in your partner dashboard app settings, there is no need to register them as a topic in your app. See our guide on GDPR webhooks here: https://help.shopify.com/en/api/guides/gdpr-resources#mandatory-webhooks.
Ryan | Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit the Shopify Help Center or the Shopify Blog
@Ryan getting the same error as OP. Looking at the WebhookSubscriptionTopic enum here:
https://help.shopify.com/en/api/graphql-admin-api/reference/object/webhooksubscription/webhooksubscr...
It does not seem as if there is any topic for those GDPR hooks.
I've registered the endpoints on my partner dashboard, but still getting those "failed to register webhook" messages because registerWebhook keeps failing.
Ah, actually, you don't need to register the GDPR webhooks: https://community.shopify.com/c/Shopify-APIs-SDKs/Do-I-register-for-GDPR-Hooks/td-p/600013
What you need to do:
1. Implement the three required endpoints for the three webhooks (as in, make `{HOST}/webhooks/customers/redact`, `{HOST}/webhooks/shop/redact` and `{HOST}/webhooks/customers/data_request` actually return something
2. Add `{HOST}/webhooks/customers/redact` (with `{HOST}` substituted for your actual host) to your app's setup.