Switching to Shopify managed webhooks

Solved

Switching to Shopify managed webhooks

DavidT
Shopify Partner
32 2 12

I want to switch to the new way of managing webhooks through the config file. But I want some clarification on exactly how this works for existing webhook subscriptions, because I don't want to break anything. So is this just automatically applied to all shops on installation? Do I have to use the GraphQL API to unsubscribe the old users from the webhooks if I want to take advantage of the new filters feature? If I switch to the new way, will it just automatically apply to all users right away or only new users?

 

Originally posted in Slack: https://shopifypartners.slack.com/archives/C4E5GV5U4/p1719430887032349

QuickEdit - Bulk Product Edit - Quick and easy bulk editor for products and variants.
SafeShip - Address Validator - International address validation and PO box blocking at checkout for Shopify Plus merchants.
Accepted Solution (1)

DavidT
Shopify Partner
32 2 12

This is an accepted solution.

Okay, so it looks like if you have webhooks subscribed using the old method, they will still be active. So you will receive 2 webhooks, one from the old subscription and one from the new managed webhook. So you need to unregister the old ones. The easiest way to do that is remove all the webhook handlers in your code and then call 'await shopify.webhooks.register({ session });' The register function (as of v6 of the library) adds, removes, or updates the webhook subscriptions as necessary, depending on your handlers set, so if you don't add any handlers it will remove all subscriptions, leaving only the Shopify managed ones. You will have to do this for every shop in your database.

QuickEdit - Bulk Product Edit - Quick and easy bulk editor for products and variants.
SafeShip - Address Validator - International address validation and PO box blocking at checkout for Shopify Plus merchants.

View solution in original post

Reply 1 (1)

DavidT
Shopify Partner
32 2 12

This is an accepted solution.

Okay, so it looks like if you have webhooks subscribed using the old method, they will still be active. So you will receive 2 webhooks, one from the old subscription and one from the new managed webhook. So you need to unregister the old ones. The easiest way to do that is remove all the webhook handlers in your code and then call 'await shopify.webhooks.register({ session });' The register function (as of v6 of the library) adds, removes, or updates the webhook subscriptions as necessary, depending on your handlers set, so if you don't add any handlers it will remove all subscriptions, leaving only the Shopify managed ones. You will have to do this for every shop in your database.

QuickEdit - Bulk Product Edit - Quick and easy bulk editor for products and variants.
SafeShip - Address Validator - International address validation and PO box blocking at checkout for Shopify Plus merchants.