How to check if store has uninstalled our app

devdude
Excursionist
23 1 19

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
Reply 1 (1)
mikedasilva
Shopify Staff
50 4 4

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

mikedasilva | Developer @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog