Remove page before application uninstalled

Nariman_Abliev
New Member
6 0 0

Hi,

My app needs to remove custom page when user uninstalls application. I've created subscription for "app/uninstalled" event.

But when during processing that webhook my code tries to remove my app's page it gets "Unauthorized" response, though it didn't yet response with 200(OK) to server in response for webhook.

Is it possible to remove page when user uninstalls application?

Thanks, Nariman

 

0 Likes
Nariman_Abliev
New Member
6 0 0

up

0 Likes
Nariman_Abliev
New Member
6 0 0

Can anyone help me. Need an answer. Is it possible to remove custom page when user decides to uninstall application?

Now when webhook "app/uninstalled" is being triggered and app tries to send page delete message it receives "Unauthorized" response.

At which stage exactly application access token gets removed on server? Just after user confirms he(she) wants to uninstall app?

0 Likes
Jason
Shopify Expert
10037 119 1872

At which stage exactly application access token gets removed on server? Just after user confirms he(she) wants to uninstall app?

I would have expected the token to be purged immediately after confirming which is why you're getting the error. Your app no longer has access. Webhooks do not fire in real time either so you should expect some delay before the webook is sent.

Even if you could delete a page, that sounds like a bad idea. Imagine how annoyed a store owner would be if you deleted a page that they added custom content to.

★ Winning Partner of the Build a Business competition. ★ http://freakdesign.com.au
0 Likes
Zetya_Gavin
Shopify Partner
1245 6 96
Consider this hook event as simply the chance to do housekeeping on your side. Shopify recommends you integrate via the scrip tag functionality. That way when your app is uninstalled it will no longer be called and you are done. Unfortunately the way this works it your script loads *after* all the pinterests and facebooks from the theme so going that way will result in lots of your users complaining about how slow your app is no matter how fast it actually is. What we do is create a snippet that then gets included into the product or cart page. To "uninstall" means the store owner additionally has to remove that line or empty the snippet.
www.bookthatapp.com
0 Likes
Nariman_Abliev
New Member
6 0 0

Hi guys,

Thank you for explanation. I didn't think about possibility for user to add custom content to my custom page. That sounds quite reasonable.

 

 

 

0 Likes
darrynten
Shopify Partner
11 0 3

This is still a problem, 6 years later.

@darrynten
0 Likes
peter90
New Member
5 0 0

yes this is still a problem

 

0 Likes
BStubbs
Shopify Partner
124 14 45

This isn't really a 'problem', more a feature of Shopify. Once you uninstall the app, the app can no longer interact with your shop. Thats the beauty of a platform like Shopify.

The best solution I have found:

1. Create the page with the api, but populate the page with a ScriptTag.

2. The ScriptTag will be removed when the app is uninstalled automatically, so any app features you added will be removed.

Just a suggestion.

Was this helpful? Press like!
Did it fix the problem? Mark it as the solution for others!
Buy me a beer? Well, sure!
0 Likes
darrynten
Shopify Partner
11 0 3

ScriptTag loads waaaay too late for a lot of use cases.

A possible fix would be to add a small delay/timeout to the token revocation when an app has the edit theme permission.

@darrynten
0 Likes