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?
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.