How to check if store has uninstalled our app

How to check if store has uninstalled our app

devdude
Excursionist
23 1 21

I know webhooks are inherently unreliable and the docs recommend not depending on them fully. So my question is how can we reliably determine if an app is uninstalled in the case when no "uninstall" webhook was called?

We currently have several cases where the user uninstalled but due to error in processing of webhooks our app doesn't know and continuously bangs into 401 trying to do normal every day processing.

 

One approach would be to send a "ping" request, for exame to get shop,json at interval and then look at the return;

2xx = all good

401 = user uninstalled

4xx = api version mismatch?

5xx / timeout /whatever else = wait for a while and try again

 

 

This seems kind of hackis, so is there an endpoint that would let us know the status of a store vs. our app?

https://www.merchbot.net
Replies 2 (2)

mikedasilva
Shopify Staff (Retired)
61 7 13

Hi,

The webhook should be reliable however if you're having issues on your end processing the webhook itself, then that won't be useful for you. It's best to try and resolve the issues you're having with processing the webhooks sent. However, as another method, I believe you should be able to call the API to get the shop (as you mentioned) using the token for that shop. If that call doesn't work due to an issue with the token, that would indicate that you no longer have permission because the shop has uninstalled your app.

Cheers,

Mike

To learn more visit the Shopify Help Center or the Community Blog.

JonidaM
Shopify Partner
5 0 5

@mikedasilva what should be the exact response of the call to the API for the uninstalled stores? How can we differentiate between an uninstall store and an expired token?