{
  "name": "Monitor D2C inventory, forecast demand with GPT-4o, and send POs via Google Sheets and Gmail",
  "nodes": [
    {
      "id": "0620182f-f823-4314-bef7-b0407101813a",
      "name": "Read Inventory Master",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        160,
        368
      ]
    },
    {
      "id": "f50a2acb-4424-41c8-9ac0-18e46b90694e",
      "name": "Read Sales Log",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        368,
        368
      ]
    },
    {
      "id": "c3eea98f-c39b-4614-b3bd-94b9a70338ed",
      "name": "IF Dead or Overstock",
      "type": "n8n-nodes-base.if",
      "position": [
        1200,
        480
      ]
    },
    {
      "id": "ef6ce76b-5d3b-4d00-8e3d-d6c41344499d",
      "name": "IF Stockout Risk",
      "type": "n8n-nodes-base.if",
      "position": [
        784,
        368
      ]
    },
    {
      "id": "9377ea2f-47f6-4ae2-b7ef-3f8be41c343c",
      "name": "Read Inventory Master1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        176,
        864
      ]
    },
    {
      "id": "1602da5d-5c06-4cdb-aca2-f6e7bd303f89",
      "name": "Read Inventory Master2",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        224,
        1216
      ]
    },
    {
      "id": "c83fe074-7e1c-4c43-9ca3-da59ad4a2f53",
      "name": "Read sales log",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        208,
        1600
      ]
    },
    {
      "id": "ffab12e1-850f-4494-b434-d7d019be6012",
      "name": "Read Inventory Master3",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        464,
        1600
      ]
    },
    {
      "id": "5186099d-1f5f-4452-88b8-8e207ad7b9f2",
      "name": "Build Forecast Prompt",
      "type": "n8n-nodes-base.code",
      "position": [
        880,
        1600
      ]
    },
    {
      "id": "068f460e-5619-4ab0-b888-795d31a74786",
      "name": "Build Forecast Email",
      "type": "n8n-nodes-base.code",
      "position": [
        1872,
        1600
      ]
    },
    {
      "id": "bde2be38-dadd-40d9-ba76-3293523b4474",
      "name": "🕐 Daily 8AM Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        16,
        -64
      ]
    },
    {
      "id": "1a31a9c6-e84e-4d1c-97d6-2a1de903b70d",
      "name": "Fetch Products (DummyJSON)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        224,
        -64
      ]
    },
    {
      "id": "bedcf14a-df6e-49f1-ba87-c28776d02d22",
      "name": "Simulate Daily Sales",
      "type": "n8n-nodes-base.code",
      "position": [
        432,
        -64
      ]
    },
    {
      "id": "3fa0f789-297b-4700-9f9b-112a839559ae",
      "name": "Log to Sales Log",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        640,
        -64
      ]
    },
    {
      "id": "19ba04ad-07a7-4e3e-9e8a-ad08eeadcb82",
      "name": "Write to Inventory Master",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        816,
        -64
      ]
    },
    {
      "id": "54ec7660-44a0-4a71-93c6-810d56611026",
      "name": "Daily 8:05AM Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -32,
        368
      ]
    },
    {
      "id": "2aa23deb-d39f-4991-bc4b-dda02f0df9ec",
      "name": "Calculate Velocity & Flags",
      "type": "n8n-nodes-base.code",
      "position": [
        576,
        368
      ]
    },
    {
      "id": "14ccf51c-ea11-4931-9d81-09f6556809e3",
      "name": "Alert — Stockout Risk",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1168,
        256
      ]
    },
    {
      "id": "0feee8fb-8e80-4c46-b0f3-88eb33d85d82",
      "name": "Alert — Dead Stock",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1456,
        480
      ]
    },
    {
      "id": "45503525-894c-4456-bf01-c15db6f485a2",
      "name": "Update Flags (Stockout)",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1408,
        256
      ]
    },
    {
      "id": "b8be79b7-3b1b-4248-b9f9-2d9671e6a386",
      "name": "Update Flags (Dead Stock)",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1648,
        480
      ]
    },
    {
      "id": "4dac2963-f047-42cc-83a1-f1a5c91f2d03",
      "name": "Daily 8:10AM Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -32,
        864
      ]
    },
    {
      "id": "9ab21aa5-8d68-4ea2-928c-455f7eac796a",
      "name": "Filter Stockout SKUs",
      "type": "n8n-nodes-base.if",
      "position": [
        432,
        864
      ]
    },
    {
      "id": "881626ca-0549-4ba2-b94f-1559f0754976",
      "name": "Calculate Reorder Quantity",
      "type": "n8n-nodes-base.code",
      "position": [
        688,
        848
      ]
    },
    {
      "id": "b5d419e0-0a13-46e4-b2fe-37329e91720b",
      "name": "Skip Zero-Velocity SKUs",
      "type": "n8n-nodes-base.filter",
      "position": [
        896,
        848
      ]
    },
    {
      "id": "c7632c00-f89d-43b7-86cf-ba8cfb803a9d",
      "name": "Send PO to Supplier",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1152,
        848
      ]
    },
    {
      "id": "550d47a4-1b60-4d46-b894-a308292c49d9",
      "name": "Log PO to Tracker",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1424,
        848
      ]
    },
    {
      "id": "6d9acff7-f4dd-4066-b975-f395b92851e8",
      "name": "Notify — PO Raised",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1648,
        848
      ]
    },
    {
      "id": "a9a0e2dc-b3ec-4fb2-b97a-a8feaa22c28a",
      "name": "Weekly Sunday 9AM Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -32,
        1216
      ]
    },
    {
      "id": "fbcc1836-0d7c-4567-965d-7dba92c56f60",
      "name": "Filter Dead & Overstock SKUs",
      "type": "n8n-nodes-base.if",
      "position": [
        448,
        1216
      ]
    },
    {
      "id": "bc88e652-9cd7-4f3b-a4fe-d71f7cc76b5f",
      "name": "Build GPT Prompt",
      "type": "n8n-nodes-base.code",
      "position": [
        704,
        1200
      ]
    },
    {
      "id": "9f5e2a85-dcc3-4417-bd05-9e1a92ce6d46",
      "name": "Inventory Strategist",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        912,
        1200
      ]
    },
    {
      "id": "19c59165-b6fd-4720-9692-7ad8f486a4dc",
      "name": "Parse AI Recommendations",
      "type": "n8n-nodes-base.code",
      "position": [
        1312,
        1200
      ]
    },
    {
      "id": "e7fa7049-e1c8-4522-81c5-01268c567303",
      "name": "Build Weekly Digest Email",
      "type": "n8n-nodes-base.code",
      "position": [
        1584,
        1200
      ]
    },
    {
      "id": "c15efca7-1dd2-44cb-8546-6b5fc54eb591",
      "name": "Send Weekly Digest",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1840,
        1200
      ]
    },
    {
      "id": "b4ba5ab1-ba8e-4afe-838b-2773dd798453",
      "name": "Weekly Sunday 9:30AM Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        0,
        1600
      ]
    },
    {
      "id": "f43d4ac3-1246-4900-be86-ab15e9878f5c",
      "name": "Aggregate 90 Day Sales",
      "type": "n8n-nodes-base.code",
      "position": [
        672,
        1600
      ]
    },
    {
      "id": "2034f56f-9831-4cb5-818d-6ad551378384",
      "name": "Demand Forecaster",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1072,
        1600
      ]
    },
    {
      "id": "2ea28460-d886-441a-abaa-b19370fa58fa",
      "name": "Parse Forecast Response",
      "type": "n8n-nodes-base.code",
      "position": [
        1440,
        1600
      ]
    },
    {
      "id": "fb22c616-16fa-4330-a3fc-8077a096bf01",
      "name": "Filter Actionable SKUs",
      "type": "n8n-nodes-base.filter",
      "position": [
        1648,
        1600
      ]
    },
    {
      "id": "95f32b05-b06f-4e95-99bc-60377e400c05",
      "name": "Send Forecast Report",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2096,
        1600
      ]
    },
    {
      "id": "e4d83949-0cd3-4ced-aa4d-ce3ae332c6cb",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -960,
        -512
      ],
      "parameters": {
        "width": 384,
        "height": 656,
        "content": "## 🛒 D2C Supply Chain Brain Overview\n\nThis workflow runs your inventory on autopilot. \nIt pulls product data daily, tracks how fast things \nare selling, flags what's about to run out, raises \npurchase"
      }
    },
    {
      "id": "acc64139-6caf-4a61-b456-975626daae91",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -128,
        -176
      ],
      "parameters": {
        "width": 1168,
        "height": 304,
        "content": "Runs daily at 8AM. Pulls 20 products from  DummyJSON, simulates daily sales, and writes  everything into Inventory Master and Sales Log.  This feeds all other sub-workflows."
      }
    },
    {
      "id": "78a3f77b-9824-4d67-9d47-c42ba21ab8ce",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -144,
        208
      ],
      "parameters": {
        "width": 2000,
        "height": 464,
        "content": "Runs at 8:05AM daily. Reads last 7 days of sales,  calculates velocity per SKU, flags each one as  🔴 🟡 or 🟢, updates the sheet, and fires  email alerts if action is needed."
      }
    },
    {
      "id": "c9d24c85-2585-4c63-8b53-596d255a6342",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -112,
        752
      ],
      "parameters": {
        "width": 2000,
        "height": 304,
        "content": "Runs at 8:10AM daily. Picks up 🔴 SKUs from the  sheet, calculates reorder quantity using lead time  and buffer stock formula, emails the supplier a PO,  and logs it in PO Tracker automatically"
      }
    },
    {
      "id": "b291e85a-24b6-4cc3-a660-31824e33503c",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -96,
        1120
      ],
      "parameters": {
        "width": 2144,
        "height": 272,
        "content": "Runs every Sunday at 9AM. Sends all 🟡 SKUs to  GPT-4o and gets back actionable recommendations —  bundle, discount, or kill. Delivered as a clean  digest email grouped by urgency."
      }
    },
    {
      "id": "985030d5-eaa8-4123-8ad2-c1bcab4b7cc2",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -112,
        1488
      ],
      "parameters": {
        "width": 2416,
        "height": 352,
        "content": "Runs every Sunday at 9:30AM. Aggregates last 90  days of sales per SKU, sends it to GPT-4o with  seasonal context, and emails a 30-day forecast  showing exactly what to reorder before you run out."
      }
    }
  ],
  "connections": {
    "Read Sales Log": {
      "main": [
        [
          {
            "node": "Calculate Velocity & Flags",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read sales log": {
      "main": [
        [
          {
            "node": "Read Inventory Master3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build GPT Prompt": {
      "main": [
        [
          {
            "node": "Inventory Strategist",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF Stockout Risk": {
      "main": [
        [
          {
            "node": "Alert — Stockout Risk",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "IF Dead or Overstock",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log to Sales Log": {
      "main": [
        [
          {
            "node": "Write to Inventory Master",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Demand Forecaster": {
      "main": [
        [
          {
            "node": "Parse Forecast Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log PO to Tracker": {
      "main": [
        [
          {
            "node": "Notify — PO Raised",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send PO to Supplier": {
      "main": [
        [
          {
            "node": "Log PO to Tracker",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Alert — Dead Stock": {
      "main": [
        [
          {
            "node": "Update Flags (Dead Stock)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Forecast Email": {
      "main": [
        [
          {
            "node": "Send Forecast Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Daily 8:05AM Trigger": {
      "main": [
        [
          {
            "node": "Read Inventory Master",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Daily 8:10AM Trigger": {
      "main": [
        [
          {
            "node": "Read Inventory Master1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Stockout SKUs": {
      "main": [
        [
          {
            "node": "Calculate Reorder Quantity",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF Dead or Overstock": {
      "main": [
        [
          {
            "node": "Alert — Dead Stock",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Inventory Strategist": {
      "main": [
        [
          {
            "node": "Parse AI Recommendations",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simulate Daily Sales": {
      "main": [
        [
          {
            "node": "Log to Sales Log",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Forecast Prompt": {
      "main": [
        [
          {
            "node": "Demand Forecaster",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Inventory Master": {
      "main": [
        [
          {
            "node": "Read Sales Log",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate 90 Day Sales": {
      "main": [
        [
          {
            "node": "Build Forecast Prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Actionable SKUs": {
      "main": [
        [
          {
            "node": "Build Forecast Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Inventory Master1": {
      "main": [
        [
          {
            "node": "Filter Stockout SKUs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Inventory Master2": {
      "main": [
        [
          {
            "node": "Filter Dead & Overstock SKUs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Inventory Master3": {
      "main": [
        [
          {
            "node": "Aggregate 90 Day Sales",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🕐 Daily 8AM Trigger": {
      "main": [
        [
          {
            "node": "Fetch Products (DummyJSON)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Alert — Stockout Risk": {
      "main": [
        [
          {
            "node": "Update Flags (Stockout)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Forecast Response": {
      "main": [
        [
          {
            "node": "Filter Actionable SKUs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Skip Zero-Velocity SKUs": {
      "main": [
        [
          {
            "node": "Send PO to Supplier",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse AI Recommendations": {
      "main": [
        [
          {
            "node": "Build Weekly Digest Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Weekly Digest Email": {
      "main": [
        [
          {
            "node": "Send Weekly Digest",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Weekly Sunday 9AM Trigger": {
      "main": [
        [
          {
            "node": "Read Inventory Master2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculate Reorder Quantity": {
      "main": [
        [
          {
            "node": "Skip Zero-Velocity SKUs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculate Velocity & Flags": {
      "main": [
        [
          {
            "node": "IF Stockout Risk",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Products (DummyJSON)": {
      "main": [
        [
          {
            "node": "Simulate Daily Sales",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Dead & Overstock SKUs": {
      "main": [
        [
          {
            "node": "Build GPT Prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Weekly Sunday 9:30AM Trigger": {
      "main": [
        [
          {
            "node": "Read sales log",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}