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 the GraphQL 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.
On this page
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 the Cancel order action and potentially canceling the wrong order, you can start by using the Send internal email action, or the Send Slack message action if you use Slack.
Steps:
- Choose a trigger that can be triggered manually.
- Add an action to the workflow and connect it to the trigger, such as Send internal email.
- Add the variables that you want to inspect to the Message section of the Send internal email action.
- Click Turn on workflow.
- Trigger the workflow, either by running it manually or by causing the trigger to fire. For example, if you're using the Order created trigger, then create a test order.
- 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 the Order, Product, or Customer pages, 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 .json
to the URL.
For example, navigate to an order by going in the Shopify admin to the Orders page 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/<shopname>/orders/3804849891234
To the following:
https://https://admin.shopify.com/store/<shopname>/orders/3804849891234.json
Use GraphiQL or a third-party API tool
You can directly query the API by using a third-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 a web-based GraphiQL explorer with generic data and the GraphiQL 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 {
createdAt
app {
name
}
channelInformation {
app {
title
}
}
}
}
}
In the following results, the variable order / app / name
displays the app name for the order. In this case, the order was created from the draft orders app, so the value is Draft Orders
. Channel information is only available for the Point of Sale
app.
{
"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"
}
}
}
]
}
}