webhook is not registered

Solved
Tourist
7 0 1

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

Success.

Shopify Staff
Shopify Staff
373 50 57

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.

0 Likes
New Member
2 0 0

We are having the same issue.

0 Likes
Tourist
7 0 1

Hello @scottydont,

 

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 @scottydont  to clearing my concept.

1 Like