Cleanup after uninstalling the shopify app

Cleanup after uninstalling the shopify app

weebySagar
Shopify Partner
17 1 3

After uninstalling the app the uninstalled webhook is triggered so that I can cleanup the user data in my database.
But Iam cleaning up the DB based on shop's ID not the domain because domain can be changed , so to get the shop's ID I have to query the admin API but thats the issue after uninstalling the access token has been revoked immediately.
Any alternate solution would be helpful.

Replies 2 (2)

JayAdra
Shopify Partner
146 14 38

The domain sent in the "x-shopify-shop-domain" header should be the myshopify shop ID, which cannot be changed, so you should be fine to use that. This is different from the public facing domain the shop can configure and change.

weebySagar
Shopify Partner
17 1 3

Thanks for the reply but the value of this header x-shopify-shop-domain seems to same as the shop front store domain , suppose if anyone changed the domain so this also be changed or not ?

also I saving the shop ID which looks like this : gid://shopify/Shop/<number>
I got this ID by querying 

 

 

let response = await admin.graphql(
    `query {
            shop {
                name
                email
                id
                url
            }
        }`,
  );