Block webhook from non subscribers

My request time has surged a lot lately and it is mostly triggered by webhooks being processed. However, more than half of my app users aren't subscribed to a plan and their webhooks are being processed for no use basically, as the app is not functional for them. Currently I have a simple conditional block that calls the mantle api to check if a store is subscribed and return if they aren't but is there a way like shopify webhook filtering to entirely eliminate them?
11 Replies
Chocci_Milk
Chocci_Milk6mo ago
Hello, Have you looked at disabling webhooks for users in the install and reinstall actions? Here are some docs: https://docs.gadget.dev/guides/plugins/shopify/shopify-webhooks#disable-webhook-processing-per-shop
safwan
safwanOP6mo ago
does this work for conditionally registered webhooks too? So I moved my app functionality from a model action to a global action triggered by a webhook. What to do about it?
Chocci_Milk
Chocci_Milk6mo ago
That wouldn't work for global action webhook handling. That only works from models managed by Gadget. Let me talk to the team to see if the workaround I have in mind would work Actually, it looks like disabledWebhooks should also disable global action webhook handling For disabling product webhooks use:
{
shopifyProduct: true
}
{
shopifyProduct: true
}
For example ^
safwan
safwanOP6mo ago
oh so for instance I disable webhooks for shopifyOrder would that disable it for all order topics such as orders/create, orders/fulfill? or is there a way to filter those too?
Chocci_Milk
Chocci_Milk6mo ago
Thats correct. There's no way to go further in to disable specific topics at the moment
safwan
safwanOP5mo ago
okay this works just as well thanks I tried updating the webhook subscription and got the following error: Error processing subscription cancellation: [GraphQL] Variable "$shopifyShop" got invalid value { disabledWebhooks: { shopifyCheckout: true, shopifyOrder: true } }; Field "disabledWebhooks" is not defined by type "UpdateShopifyShopInput". route: /subscriptionCancelled and it isnt available in my api docs either
ljspoor94
ljspoor945mo ago
Use the internal api to update disabledWebhookw
safwan
safwanOP5mo ago
works like a charm thanks:) petition for ljspoor to be a gadget emloyee okay so this is just disabling webhooks for orders/create, orders/fulfilled and orders/cancelled are being firec and processed normally testing with different models for shopifyFulfillments and shopifyFulfillments events etc to see if something works
safwan
safwanOP5mo ago
alright so i tried playing around with this and something has messed up but my webhooks are stuck at registering, tried installing and reinstalling but nope nothing changes, it is stuck here and wont fire the wbehooks either:
No description
safwan
safwanOP5mo ago
stuck here too sync wasnt working either and had to abort it:
No description
safwan
safwanOP5mo ago
none of the wbehooks are firing pls help okay no i am recieving the webhooks but the webhooks are still stuck registering on my end this is really confusing, i have removed the logic to disable webhooks since it is causing unnecessary complication but yet there is some cionfusion

Did you find this page helpful?