webhook is not registered

Solved
Highlighted
Tourist
7 0 3

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

 

$params= array('webhook' =>
            array(
                'topic' => 'app/uninstalled' ,
                'address' => "https://exampleserver.com/public/uninstallapp",
                'format' => "json"
               
            )
        );

 

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

0 Likes
Highlighted
Shopify Staff
Shopify Staff
1041 140 170

This is an accepted solution.

Hey @devsb399,

 

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.

Notice; Out of office, replies will be delayed until my return. Thanks!
0 Likes
Highlighted
Shopify Partner
2 0 0

We are having the same issue.

0 Likes
Highlighted
Tourist
7 0 3

Hello @SBD_,

 

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.