Preview API data used in Shopify Flow

When you build a workflow, you might often want to use data from your store in conditions and actions. Shopify Flow accesses store data by calling theGraphQL Admin API, which means you have access to nearly all the fields in the API.

As you build a workflow, you will often encounter field names and descriptions based on the API, but you might need to know what data is output by the API. For example, you might want to know the app name for an order that was created from a draft order. In addition, you might want to make sure that your workflow outputs the data that you are expecting, or in the form that you are expecting.

To review the data, you have several options in Shopify Flow.

Find a field in the Shopify admin

In most cases, the data is available in the Shopify admin.

Use the field in a live workflow

You can build a workflow using actions that help you to to review the data rather than the actions that you plan to use in the final version. For example, suppose that you want to create a workflow that cancels an order. Instead of using theCancel orderaction and potentially canceling the wrong order, you can start by using theSend internal emailaction, or theSend Slack messageaction if you use Slack.

Steps:

  1. Choose a trigger that can be triggered manually.
  2. Add an action to the workflow and connect it to the trigger, such asSend internal email.
  3. Add the variables that you want to inspect to theMessagesection of theSend internal emailaction.
  4. ClickTurn on workflow.
  5. Trigger the workflow, either byrunning it manuallyor by causing the trigger to fire. For example, if you're using theOrder createdtrigger, then create a test order.
  6. After the workflow runs, check your email for the variables.

Refer to the resource JSON page

Most resource pages in the Shopify admin, such as theOrder,Product, orCustomerpages, allow you to view the data that serves the page. This data isn't exactly the same naming and format that Shopify Flow uses, but the values match what is in the GraphQL Admin API. To review the data, add.jsonto the URL.

For example, navigate to an order by going in the Shopify admin to theOrderspage and clicking an order. In the address of the page in the address bar of your browser, change the address from:

https://https://admin.shopify.com/store//orders/3804849891234

To the following:

https://https://admin.shopify.com/store//orders/3804849891234.json

Use GraphiQL or a third-party API tool

你可以直接查询使用这个APIrd-party API tool like Postman or the free Shopify-provided tool, GraphiQL. This option provides the most accurate results, but it does require some familiarity with creating GraphQL queries.

For GraphiQL, Shopify offers both aweb-based GraphiQL explorerwith generic data and theGraphiQL app. With GraphiQL, you can build a GraphQL query which exactly matches the field names that you see in Shopify Flow. The values also exactly match your store if you use the app.

By using this tool, you can determine exactly what data Shopify Flow uses, with your real shop data. For example, you create the following query:

{orders(first:5,reverse:true){nodes{createdAtapp{name}channelInformation{app{title}}}}}

In the following results, the variableorder / app / namedisplays the app name for the order. In this case, the order was created from the draft orders app, so the value isDraft Orders. Channel information is only available for thePoint of Sale应用程序。

{"data":{"orders":{"nodes":[{"createdAt":"2023-04-10T12:32:41Z","app":{"name":"Draft Orders"},"channelInformation":null},{"createdAt":"2023-04-10T12:29:12Z","app":{"name":"Draft Orders"},"channelInformation":null},{"createdAt":"2023-03-17T20:23:10Z","app":{"name":"Draft Orders"},"channelInformation":null},{"createdAt":"2023-03-17T20:20:53Z","app":{"name":"Draft Orders"},"channelInformation":null},{"createdAt":"2023-03-17T15:45:15Z","app":{"name":"Point of Sale"},"channelInformation":{"app":{"title":"Point of Sale"}}}]}}
Ready to start selling with Shopify?Try it free