Is there a way to update the webhook without restarting the application?

I need to update the webhook, such as for product updates or deletions, without restarting the application.

Hello Sabin,

that depends on the mechanism you used to subscribe.

If you’re using the toml file to declare your subscriptions, then you simply need to update your toml and redeploy it with shopify app deploy.

If you’re not and you’re using the registerWebhooks mechanism, then the best would be to restart the app.

If you subscribed via AdminAPI directly, or you want a workaround for the registerWebhooks case, you can update your subscriptions manually with webhookSubscriptionUpdate via the Admin GraphQL API

If you do this and you’re using also registerWebhooks, it’s crucial that you remember to update registerWebhooks config in your app too, because the next time you restart it, this configuration will override anything that you’ve done manually.

If you have a lot of installations, you’ll need a script to do this

3 Likes

I have added the subscription code to the shopify.app.toml file and created a component accordingly. Below are the details of the issue I am facing:

For instance, when I attempt to add a webhook for products/update, I include a filter such as filter="id:* AND title:*". After running the shopify app deploy command, the console indicates that the webhooks have been updated. However, the actual data is not provided until I restart the app. It works temporarily, but if I modify the filter again, the data is not valid until another restart.

it’s working for me without restarting, even without the app running (using an external destination url, with a service such as webhook.site).

Could you try that? using an external service to test the reception?
Also (just in case) notice that the filter is on the product title, not on the variant titles

1 Like

Alright, I’ll give that way a try too.