Is it possible to delete a webhook after reinstalling the plugin?

5 0 1

Let's say I have a Shopify plugin I made. Here's a scenario:

1. Creates a webhook (any) via the Admin API. For communication purposes, let's refer to this created webhook with an id value of "12345".

2. I, as the store owner, decides to delete the Shopify plugin I made.

3. Then after deleting the plugin, I decide that I want to reinstall the plugin. This means the plugin will re-create the webhook (let's say this new webhook has a id of "33333") needed for the plugin to do whatever it needs to do.

With this scenario in mind, this leads me to my questions:

- Let's say my plugin, during the installation callback process, runs a API Call to the Admin API to scan for all existing webhooks that matches certain parameters to identify whether or not it was potentially made by my plugin (matching topic and matching callback address). Whatever matches it finds after doing some basic filter/map() via javascript, can this newly reinstalled plugin (from step 3) delete the webhook 12345 created from step 1?

- As the store owner, when I finish deleting the Shopify plugin from my Shopify store, does webhook 12345 automatically get deleted by the Shopify's system?


The plugin contains the logic needed to create the webhook through the API.

The plugin contains the logic needed to delete a specific webhook through the API only during initial setup when plugin installed to the store.

Thank you.