How to remove pages at the time of application uninstallation

Highlighted
Tourist
14 0 0

Hi, I am creating public app in that I have created the pages at the time of app installation.
Now, when someone uninstalls the app that time want to delete those pages.
I have created app/uninstalled webhook for page deletion but I am getting error from shopify API like "[API] Invalid API key or access token (unrecognized login or wrong password)".
I have tested page delete shopify API before app uninstallation in postman and works fine.
I didn't understand why it's not working with webhook.

Reply

0 Likes
Highlighted
Shopify Staff
Shopify Staff
1127 79 162

Hey @Annex_Cloud , 

 

At the point your app is uninstalled and triggers the webhook to you, your API access token will have already been revoked. So you won't be able to perform any actions on the shop, such as deleting the pages you've created.

 

The only way that this would work is to remove the pages before your app is uninstalled, which can't be done since it's not possible to predict when your app is going to be removed ahead of time. 

 

 

1 Like
Highlighted
New Member
1 0 0
Hi @Josh, I have a similar issue.
My app, on installation, creates some snippet files and changes some theme files to include these snippets. I have to remove these includes and snippets before uninstallation.
This is not possible as already stated in this and some other posts. The only way is to provide an uninstallation guide to the user.

Is this still the only solution right now?
0 Likes
Shopify Staff
Shopify Staff
1127 79 162

Hey @stefanomarra , 

 

At the moment that is the only solution, yes - stay tuned though, I believe there are some things in the works to address this. 

0 Likes