How to get uninstall reason from Partner API

Solved
redo-pauldraper
Shopify Partner
1 0 0

I'm trying to get the reason for app uninstall. The field in the docs: https://shopify.dev/docs/api/partner/2023-01/objects/RelationshipUninstalled#field-relationshipunins...

 

But the GraphQL query doesn't work:

 

{
  app(id: "gid://partners/App/3426665") {
    events(types: [RELATIONSHIP_UNINSTALLED]) {
      edges {
        node {
          reason
        }
      }
    }
  }
}

That returns

{
  "errors": [
    {
      "message": "Field 'reason' doesn't exist on type 'AppEvent'",
      "locations": [
        {
          "line": 37,
          "column": 11
        }
      ],
      "path": [
        "query",
        "app",
        "events",
        "edges",
        "node",
        "reason"
      ],
      "extensions": {
        "code": "undefinedField",
        "typeName": "AppEvent",
        "fieldName": "reason"
      }
    }
  ]
}

How do I get the uninstall reason?

I have a suspicion that Shopify documented this, but got tripped up by GraphQL ignorance and it's impossible to actually access it.

Accepted Solution (1)
Weaverse
Shopify Partner
41 9 9

This is an accepted solution.

 

Hi there! This is Paul from the Weaverse team. 😊

You can modify the GraphQL query to include reason, description, and shop details by using the following query:

 
{
  app(id: "gid://partners/App/3426665") {
    events(types: [RELATIONSHIP_UNINSTALLED]) {
      edges {
        node {
          ... on RelationshipUninstalled {
            reason
            description
            shop {
              id
              myshopifyDomain
              name
            }
          }
        }
      }
    }
  }
}

This query will return the uninstall reason, description, and shop details (including the shop ID, myshopifyDomain, and name) for each uninstalls event.

Let me know if this helps or if you need any further assistance. Cheers!

Helping merchants build super unique, high-performance storefronts using Weaverse + Hydrogen.
Looking for Development & Agency partners.
If you find the answer helpful, give it a thumbs up!
Our Apps: Section Builder | Hydrogen Builder (private beta)

View solution in original post

Reply 1 (1)
Weaverse
Shopify Partner
41 9 9

This is an accepted solution.

 

Hi there! This is Paul from the Weaverse team. 😊

You can modify the GraphQL query to include reason, description, and shop details by using the following query:

 
{
  app(id: "gid://partners/App/3426665") {
    events(types: [RELATIONSHIP_UNINSTALLED]) {
      edges {
        node {
          ... on RelationshipUninstalled {
            reason
            description
            shop {
              id
              myshopifyDomain
              name
            }
          }
        }
      }
    }
  }
}

This query will return the uninstall reason, description, and shop details (including the shop ID, myshopifyDomain, and name) for each uninstalls event.

Let me know if this helps or if you need any further assistance. Cheers!

Helping merchants build super unique, high-performance storefronts using Weaverse + Hydrogen.
Looking for Development & Agency partners.
If you find the answer helpful, give it a thumbs up!
Our Apps: Section Builder | Hydrogen Builder (private beta)