{
  "name": "Automate demand forecasting & inventory ordering with AI, MySQL & optimal supplier selection",
  "nodes": [
    {
      "id": "ddf6d05b-2054-4c90-9d38-1007c7968185",
      "name": "Workflow Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -272,
        -624
      ],
      "parameters": {
        "width": 420,
        "height": 560,
        "content": "## 📊 Workflow Overview\nThis workflow automates inventory replenishment by predicting demand and selecting the best supplier.\n\n## How it works\n1. **Data Collection**: Aggregates sales data (POS, DB), w"
      }
    },
    {
      "id": "67f87cf3-be25-44bd-924f-631492e09341",
      "name": "Group: Data Collection",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        336,
        0
      ],
      "parameters": {
        "width": 1240,
        "height": 288,
        "content": "## Data Collection\nGathers data from POS, database, weather, and SNS trends to build a dataset for analysis."
      }
    },
    {
      "id": "67bd99ee-7c29-46a5-b518-d89b7bd35c11",
      "name": "Group: Prediction",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1680,
        -16
      ],
      "parameters": {
        "width": 1580,
        "height": 304,
        "content": "## Prediction & Logic\nGenerates AI demand forecasts, compares against current stock, and calculates exact order quantities."
      }
    },
    {
      "id": "ebdd89da-db0c-4ca4-b7fb-d16a57100c53",
      "name": "Group: Selection",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3360,
        -48
      ],
      "parameters": {
        "width": 1240,
        "height": 336,
        "content": "## Supplier Optimization\nRequests quotes from multiple suppliers in parallel and selects the best option based on price and delivery speed."
      }
    },
    {
      "id": "0896d4e5-5320-4480-9be8-dbf467bad785",
      "name": "Group: Execution",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4704,
        -64
      ],
      "parameters": {
        "width": 1060,
        "height": 352,
        "content": "## Execution & Alerting\nPlaces the purchase order, logs the transaction to the database, and alerts Slack if manual review is needed."
      }
    },
    {
      "id": "852f2a43-392f-4970-a10b-941964bb8502",
      "name": "Run Daily at 03:00",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        384,
        144
      ]
    },
    {
      "id": "ce62bfeb-84be-4654-a251-e804c13be2f6",
      "name": "Fetch POS Data",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        608,
        144
      ]
    },
    {
      "id": "2a1e1bc0-a62a-4adb-9fe3-adeb2902fee9",
      "name": "Fetch Historical Sales",
      "type": "n8n-nodes-base.mySql",
      "position": [
        816,
        144
      ]
    },
    {
      "id": "7be15790-7d94-4f18-b4b4-5df44fe1a418",
      "name": "Fetch Weather Forecast",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1040,
        144
      ]
    },
    {
      "id": "7efd68ef-803e-4147-92a8-9052ed0cb019",
      "name": "Fetch SNS Trends",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1264,
        144
      ]
    },
    {
      "id": "78f21d75-ad56-4a93-8f37-08ff3d3761d2",
      "name": "Fetch Inventory Master",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1488,
        144
      ]
    },
    {
      "id": "94ba4b53-df63-4766-8e67-520b18a47d53",
      "name": "Merge Data 1",
      "type": "n8n-nodes-base.merge",
      "position": [
        1728,
        144
      ]
    },
    {
      "id": "6d1a2427-c2e4-48bb-acd1-dfbdbd4a4aa3",
      "name": "Merge Data 2",
      "type": "n8n-nodes-base.merge",
      "position": [
        1936,
        144
      ]
    },
    {
      "id": "834cbef6-6547-458c-94ea-55641d7a0e57",
      "name": "Format Prediction Dataset",
      "type": "n8n-nodes-base.code",
      "position": [
        2160,
        144
      ]
    },
    {
      "id": "f6af552d-08cf-4324-989d-3e9cf888e2ae",
      "name": "Call AI Prediction API",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2384,
        144
      ]
    },
    {
      "id": "8881fa92-3178-482c-9c43-138b4d09b8ec",
      "name": "Calculate Stock Shortage",
      "type": "n8n-nodes-base.code",
      "position": [
        2608,
        144
      ]
    },
    {
      "id": "653f62ff-7e43-4de5-a63e-1340b7880b5f",
      "name": "Finalize Order Qty",
      "type": "n8n-nodes-base.code",
      "position": [
        2816,
        144
      ]
    },
    {
      "id": "0a040e5e-e822-48c7-9dc6-38154dc4757f",
      "name": "Check Order Necessity",
      "type": "n8n-nodes-base.if",
      "position": [
        3040,
        144
      ]
    },
    {
      "id": "5f1235f7-bfda-40bc-8909-3de02a6e2ea2",
      "name": "Split by Product",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        3408,
        144
      ]
    },
    {
      "id": "a68ddedf-d237-4c93-b67f-05ee899fbd65",
      "name": "Get Quote Supplier A",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3616,
        144
      ]
    },
    {
      "id": "1712f494-286d-41f4-9c80-97d42927a172",
      "name": "Get Quote Supplier B",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3840,
        144
      ]
    },
    {
      "id": "945ea5bf-91df-4425-bd09-fddc86475cd3",
      "name": "Get Quote Supplier C",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        4064,
        144
      ]
    },
    {
      "id": "564e0a09-b694-4785-bb3f-2212df357658",
      "name": "Merge Quotes",
      "type": "n8n-nodes-base.merge",
      "position": [
        4288,
        144
      ]
    },
    {
      "id": "7a120dff-b0c6-4bf5-a38d-f6dbd8b86b8a",
      "name": "Select Best Supplier",
      "type": "n8n-nodes-base.code",
      "position": [
        4496,
        144
      ]
    },
    {
      "id": "79aae86f-4efd-46a8-80ac-803338b94d5c",
      "name": "Execute Auto Order",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        4736,
        144
      ]
    },
    {
      "id": "43b25e17-da22-4800-867a-657dfcc014e6",
      "name": "Update Inventory System",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        4960,
        144
      ]
    },
    {
      "id": "7c965cb2-6c15-423c-8320-451b971ff0fc",
      "name": "Save Order Log",
      "type": "n8n-nodes-base.mySql",
      "position": [
        5184,
        144
      ]
    },
    {
      "id": "2cd5aef1-b634-4078-80d3-3859d731a81f",
      "name": "Check Anomalies",
      "type": "n8n-nodes-base.if",
      "position": [
        5408,
        144
      ]
    },
    {
      "id": "e1aed4dd-850f-4422-b034-629a88cce140",
      "name": "Slack Anomaly Alert",
      "type": "n8n-nodes-base.slack",
      "position": [
        5616,
        144
      ]
    }
  ],
  "connections": {
    "Merge Data 1": {
      "main": [
        [
          {
            "node": "Merge Data 2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Data 2": {
      "main": [
        [
          {
            "node": "Format Prediction Dataset",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Quotes": {
      "main": [
        [
          {
            "node": "Select Best Supplier",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch POS Data": {
      "main": [
        [
          {
            "node": "Fetch Historical Sales",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Order Log": {
      "main": [
        [
          {
            "node": "Check Anomalies",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Anomalies": {
      "main": [
        [
          {
            "node": "Slack Anomaly Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch SNS Trends": {
      "main": [
        [
          {
            "node": "Fetch Inventory Master",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split by Product": {
      "main": [
        [
          {
            "node": "Get Quote Supplier A",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute Auto Order": {
      "main": [
        [
          {
            "node": "Update Inventory System",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Finalize Order Qty": {
      "main": [
        [
          {
            "node": "Check Order Necessity",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run Daily at 03:00": {
      "main": [
        [
          {
            "node": "Fetch POS Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Quote Supplier A": {
      "main": [
        [
          {
            "node": "Get Quote Supplier B",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Quote Supplier B": {
      "main": [
        [
          {
            "node": "Get Quote Supplier C",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Quote Supplier C": {
      "main": [
        [
          {
            "node": "Merge Quotes",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Select Best Supplier": {
      "main": [
        [
          {
            "node": "Execute Auto Order",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Order Necessity": {
      "main": [
        [
          {
            "node": "Split by Product",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Call AI Prediction API": {
      "main": [
        [
          {
            "node": "Calculate Stock Shortage",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Historical Sales": {
      "main": [
        [
          {
            "node": "Fetch Weather Forecast",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Inventory Master": {
      "main": [
        [
          {
            "node": "Merge Data 1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Weather Forecast": {
      "main": [
        [
          {
            "node": "Fetch SNS Trends",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Inventory System": {
      "main": [
        [
          {
            "node": "Save Order Log",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculate Stock Shortage": {
      "main": [
        [
          {
            "node": "Finalize Order Qty",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Prediction Dataset": {
      "main": [
        [
          {
            "node": "Call AI Prediction API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}