Hey, I’d recommend you read this doc on how to setup and process your compliance webhooks.
Its critical that you do these to comply with any local or global laws on data protection for example GDPR
How can I register webhooks in my app?
I’m not using the Shopify CLI — I’ve created the app directly from the Shopify Developer Dashboard.
You can specify them in your config file.
Hello all,
I used the shopify-app-express npm package to develop my app. As far as I know, there is no option for a .toml file. I used this code to register the webhooks:
const webhookHandlers = {
SHOP_REDACT: {
deliveryMethod: DeliveryMethod.Http as const,
callbackUrl: shopify.config.webhooks.path,
callback: async (
topic: string,
shop_domain: string,
body: string,
webhookId: string,
apiVersion?: string,
subTopic?: string,
context?: any,
) => {},
},
CUSTOMERS_REDACT: {
deliveryMethod: DeliveryMethod.Http as const,
callbackUrl: shopify.config.webhooks.path,
callback: async (
topic: string,
shop_domain: string,
body: string,
webhookId: string,
apiVersion?: string,
subTopic?: string,
context?: any,
) => {},
},
CUSTOMERS_DATA_REQUEST: {
deliveryMethod: DeliveryMethod.Http as const,
callbackUrl: shopify.config.webhooks.path,
callback: async (
topic: string,
shop_domain: string,
body: string,
webhookId: string,
apiVersion?: string,
subTopic?: string,
context?: any,
) => {},
},
APP_UNINSTALLED: {
deliveryMethod: DeliveryMethod.Http as const,
callbackUrl: shopify.config.webhooks.path,
callback: async (
topic: string,
shop_domain: string,
body: string,
webhookId: string,
apiVersion?: string,
subTopic?: string,
context?: any,
) => {// some code},
}
}
app.post(shopify.config.webhooks.path, shopify.processWebhooks({ webhookHandlers }))
But the compliance webhook check also fails for me.
The APP_UNINSTALLED code is executed when I uninstall the app. So the general webhook handler registration should work, right?.
But why does the check fail for the compliance webhooks?
Appreciate any help!
Hey, you can also these in your TOML file now just FYI. App configuration
Shopify is moving the config to TOML for all apps with the move to the dev dashboard. About Dev Dashboard
I imagine it’s not working because in your code sample. You can just handling these webhooks to an empty function and not processing the webhooks or returning a status code.
You must properly implement the compliance webhooks to comply with laws around the world, you can read more on why they are important here Privacy law compliance
