Monitor daily Shopify profit leaks with GPT-4o, Google Sheets and Slack

Go to Workflow
0 views
Built by Anna Cole Anna Cole
Created on October 07, 2026

Description

Quick overview
This workflow runs every morning to pull yesterday’s orders and product variants from Shopify, calculate profit and margin leak signals, generate a short commentary with OpenAI, post a detailed report to Slack, and append daily profit metrics to Google Sheets.

How it works
Runs every morning at 7am to prepare a “yesterday” date window and Shopify GraphQL queries.
Retrieves all of yesterday’s Shopify orders via the Shopify Admin GraphQL API using pagination.
Retrieves the full Shopify product variant catalog (including price and cost per item) via the Shopify Admin GraphQL API using pagination.
Calculates revenue, COGS, payment fees, and shipping costs to produce gross profit/margin, and flags loss-making orders, unprofitable discount codes, low-margin sellers, below-cost variants, and missing costs.
Sends the calculated profit dataset to OpenAI to generate a structured headline, key insights, and suggested actions based only on the provided numbers.
Posts a formatted profit report to a Slack channel and appends the day’s metrics as a new row in a Google Sheets tab.

Setup
Create a Shopify custom app with read_orders, read_products, and read_inventory scopes and add a Shopify Admin access token credential in n8n.
Add OpenAI API credentials, Slack credentials, and Google Sheets OAuth credentials in n8n.
Update the Configuration values (store handle, API version, payment fees, shipping cost per order, target margin, maxPages, Slack channel, and Google Sheet URL).
Ensure your Google Sheets file contains a worksheet named Daily profit with columns that match (or can be auto-mapped to) the appended fields.
Optional: enable the Meta ad spend step, add a Facebook Graph API credential, and set metaAdAccountId to subtract ad spend and calculate net profit.

Requirements
Shopify store with a custom app access token (read_orders, read_products, read_inventory scopes)
Cost per item entered for your products in Shopify
OpenAI API key
Slack workspace
Google Sheets with a tab named Daily profit
Optional: Facebook Graph API credential and Meta ad account ID for net profit after ad spend

Customization
Set your real payment fee rate, average shipping cost per order and target margin in Configuration
Enable the "Get Meta ad spend" node and set metaAdAccountId to see net profit after ads
Raise lossThreshold above 0 to also flag orders with very thin profit
Change "Set report window" to report weekly or month-to-date instead of yesterday
Add Google Ads or TikTok ad spend using the same pattern as the Meta node
Raise maxPages for stores with very high daily order volume

Additional info
All profit numbers are calculated in code from Shopify data (revenue after all discounts and refunds, cost per item, payment fees and shipping costs); OpenAI only writes the commentary and is told to use the calculated figures only. Orders and product variants are fetched with GraphQL pagination loops, so the workflow works for small and large catalogs. Test and cancelled orders are excluded, and products without a cost are reported separately instead of being counted as 100% profit.

Nodes Used (7)

Basic LLM Chain
@n8n/n8n-nodes-langchain.chainLlm
Code
n8n-nodes-base.code
Google Sheets
n8n-nodes-base.googleSheets
HTTP Request
n8n-nodes-base.httpRequest
OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi
Slack
n8n-nodes-base.slack
Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured