Summarize daily Shopify product profit with Meta, Google Ads, GPT-4o-mini & Slack

Quick overview This workflow runs daily and calculates yesterday’s profit per product by combining Shopify orders with Meta and Google Ads spend, Shiprocket shipping charges, and configured fees and RTO provisions, then uses OpenAI to write a summary and posts the report and trend chart to Slack while saving P&L history Sheets.

How it works Runs every day at 8 AM IST and sets the reporting window to yesterday. Pulls yesterday’s Shopify orders via the Shopify GraphQL Admin API and loads landed product costs from a Google Sheets “Product Costs” tab. Retrieves ad spend from Meta (Facebook Graph API) and Google Ads (campaign cost plus Shopping cost by product), continuing the run even if one ad platform request fails. Authenticates with Shiprocket and fetches yesterday’s order shipping charges, falling back to a default per-order shipping rate when charges are unavailable. Calculates contribution profit per product by allocating revenue, COGS, shipping, payment/COD fees, packaging, RTO provision, and ad spend, then compares key totals against the last 7 days from the “Daily P&L” sheet. Uses OpenAI (gpt-4o-mini) to generate a JSON profit brief and posts a formatted profit report plus a 14-day trend chart image to a Slack channel. Appends per-product rows to a “Product P&L” sheet, upserts the day’s totals into “Daily P&L”, and sends a WhatsApp alert if the day is loss-making or has multiple red flags.

Setup Add credentials for Shopify (HTTP Header Auth with an Admin API access token), Meta/Facebook Graph API, Google Ads OAuth2, Shiprocket (HTTP Custom Auth login), OpenAI, Slack, Google Sheets, and WhatsApp Business Cloud. Update the “Set Profit Config” values for your Shopify shop domain, Meta ad account ID, Google Ads customer/login customer IDs, Google Ads developer token, and your fee, packaging, shipping, and RTO assumptions. Create or update the Google Sheets document (and set its ID in the Google Sheets nodes) with tabs named “Product Costs”, “Product P&L”, and “Daily P&L”, ensuring “Product Costs” includes a SKU column and cost fields used by the workflow (for example cogs/packaging). Set the Slack channel ID in both Slack nodes and set the WhatsApp phone number ID and recipient phone number in the WhatsApp node. If you regularly exceed 250 Shopify orders per day, extend the Shopify GraphQL request with pagination to avoid partial order reporting.

0
Downloads
0
Views
8.63
Quality Score
intermediate
Complexity
Author:Rahul Joshi(View Original →)
Created:11/10/2026
Updated:11/10/2026

🔒 Please log in to import templates to n8n and favorite templates

Workflow Visualization

Loading...

Preparing workflow renderer

Comments (0)

Login to post comments