graphQL: Detecting app blocks and app embed blocks ?

Hi @den232 ,
Foladun here from the Deluxe App team. :waving_hand:

I solved this by querying the store’s themes and checking the settings_data.json file for app-related blocks.
In my case, the block I needed was in the settings_data.json file, but you can adapt this approach to check any template or file relevant to your app.

Here’s an example:

const response = await admin.graphql(`
  query GetStoreThemes {
    themes(first: 10) {
      edges {
        node {
          files(filenames: ["config/settings_data.json"]) {  // Replace with the file you're targeting
            edges {
              node {
                body {
                  ... on OnlineStoreThemeFileBodyText {
                    content
                  }
                }
              }
            }
          }
        }
      }
    }
  }
`);

const responseData = JSON.parse(await response.text()).data;
const themes = responseData.themes.edges;

themes.forEach(theme => {
  const contentJson = JSON.parse(theme.node.files.edges[0].node.body.content);
  const fileBlocks = contentJson?.current?.blocks || {};
  
  const appBlockKey = Object.keys(fileBlocks).find(blockKey =>
    fileBlocks[blockKey].type.includes('

In this example, I check the settings_data.json file because that's where my app block was located.
However, you can replace "*config/settings_data.json*" with any file or template you're targeting and adjust the block type accordingly (e.g., '*<replace-with-your-app-namespace>/blocks/<replace-with-your-block-type>'*'.

Let me know if this helps or if you need more information!

Best regards,

Foladun | **Deluxe: Account & Loyalty**
2 Likes