I am using Shopify webhook rest API with PHP to fire certain actions when someone uninstalls my Shopify app, I am using a webhook for that.
Here is the code
The Response I got from the API is
[webhook] => Array
[id] => 736758169660
[address] => https://exampleserver.com/public/uninstallapp
[topic] => app/uninstalled
[created_at] => 2020-01-06T00:59:03-05:00
[updated_at] => 2020-01-06T00:59:03-05:00
[format] => json
[fields] => Array
[metafield_namespaces] => Array
[api_version] => 2019-10
[private_metafield_namespaces] => Array
But in the backend of store examplestore.com/admin/webhooks.json, the webhook array is empty and it doesn't fire when I uninstall the app. I am totally stuck and clueless regarding this issue.
If anyone can help with me that would be really appreciated.
Thanks in advance
Solved! Go to the solution
This is an accepted solution.
The API response looks good.
But in the backend of store examplestore.com/admin/webhooks.json, the webhook array is empty.
admin/webhooks.json will only show webhooks configured by the admin, not apps. Try using the API to GET all the webhooks created by your app.
If you see it there, make sure the URL is publicly accessible.
Let me know if you're still stuck.
Happy to hear from you and thank you too for reaching to us regarding this.
I was not aware of that examplestore/admin/webhooks.json only shows the webhooks which are configured by admin. My mistake was that I was using "GET ENDPOINT" while triggering this URL, And because of that, my URL was not triggering when anyone uninstalls my app. Now everything is working fine. So the endpoint must be POST to trigger the URL.
Again thanks a ton @SBD_ to clearing my concept.