{
  "name": "AI-driven inventory management with OpenAI forecasting & ERP integration",
  "nodes": [
    {
      "id": "2557c5cc-2ee8-4241-ad2c-0e600d5923ed",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -224,
        -160
      ],
      "parameters": {
        "width": 176,
        "height": 736,
        "content": "**\"🕐 SCHEDULE TRIGGER Runs every 6 hours to check inventory levels\nYou can adjust the interval:\n- Change 'hoursInterval' to run more less frequently  Use 'minutes' for faster testing This triggers the"
      }
    },
    {
      "id": "ce149860-0f98-4be6-8fcc-fa7c6faf5b7d",
      "name": "Fetch Current Inventory",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        64,
        384
      ]
    },
    {
      "id": "ecd3f434-b692-46d0-a9cc-ce98288a7e03",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        -176
      ],
      "parameters": {
        "width": 176,
        "height": 736,
        "content": "**=📋 WORKFLOW START\nThis workflow monitors inventory levels and automatically:\n1. Checks warehouse stock\n2. Analyzes sales velocity\n3. Forecasts demand using AI\n4. Creates purchase orders\n5. Sends POs"
      }
    },
    {
      "id": "faea64a7-28e5-4c09-acf1-cee765122357",
      "name": "Fetch Sales Velocity",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        288,
        384
      ]
    },
    {
      "id": "4b00a73b-410c-48f1-bbb4-e8877477457f",
      "name": "Merge Inventory & Sales Data",
      "type": "n8n-nodes-base.code",
      "position": [
        512,
        384
      ]
    },
    {
      "id": "a4a81ad5-6880-4b7f-adfe-29c7b84b1943",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        224,
        -96
      ],
      "parameters": {
        "width": 208,
        "height": 640,
        "content": "**\"📦 FETCH INVENTORY DATA\n\nRetrieves current stock levels from warehouse system\n\nTO CONFIGURE:\n.1 Replace URL with your warehouse API endpoint\n2. Update Authorization token in headers\n3. Adjust method"
      }
    },
    {
      "id": "d76075f4-34bc-41f6-b4ac-4948d49f1725",
      "name": "AI Demand Forecasting",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        736,
        384
      ]
    },
    {
      "id": "dd60d6d1-584f-40c8-9dc0-662bfb07e003",
      "name": "Parse AI Response",
      "type": "n8n-nodes-base.code",
      "position": [
        944,
        384
      ]
    },
    {
      "id": "6ebb7486-72d7-4b24-bd1a-d009304ef851",
      "name": "Filter: Reorder Needed",
      "type": "n8n-nodes-base.filter",
      "position": [
        1168,
        384
      ]
    },
    {
      "id": "1e1b1a6d-dcf1-4432-acbb-9e659a33f4c6",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1776,
        -320
      ],
      "parameters": {
        "width": 192,
        "height": 880,
        "content": "**\"💾 LOG TO ERP SYSTEM\\n\\nRecords complete PO in your ERP system\\n\\nTO CONFIGURE:\\n1. Replace URL with your ERP API endpoint\\n   (SAP, Oracle, NetSuite, etc.)\\n2. Update Authorization credentials\\n3. "
      }
    },
    {
      "id": "4553aed7-261c-4616-bc96-10fdda53aba8",
      "name": "Create Purchase Order",
      "type": "n8n-nodes-base.code",
      "position": [
        1392,
        384
      ]
    },
    {
      "id": "8da308d4-0f2a-4ccc-844d-52476596d2f7",
      "name": "Send PO to Supplier",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1616,
        384
      ]
    },
    {
      "id": "ec290c72-159c-4511-8d3e-8235c417d69b",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2000,
        -512
      ],
      "parameters": {
        "width": 176,
        "height": 1040,
        "content": "**\"🗄️ SAVE TO DATABASE\\n\\nStores PO record in your database\\n\\nTO CONFIGURE:\\n1. Add database credentials in n8n\\n   (PostgreSQL, MySQL, etc.)\\n2. Adjust table name if different\\n3. Modify columns to "
      }
    },
    {
      "id": "66f9adca-d97d-4834-a0ac-bd8c0073b6e6",
      "name": "Log to ERP System",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1824,
        384
      ]
    },
    {
      "id": "bd21610c-e51a-4fce-ab50-7461e373eb1d",
      "name": "Save to Database",
      "type": "n8n-nodes-base.postgres",
      "position": [
        2048,
        384
      ]
    },
    {
      "id": "a5f8ada1-934f-4d3f-8ded-7fa252ff4b1f",
      "name": "Send Notification Email",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        2272,
        384
      ]
    },
    {
      "id": "b913e503-8d3f-41df-a077-31d23a25d123",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2224,
        -320
      ],
      "parameters": {
        "width": null,
        "height": 864,
        "content": "**📧 SEND NOTIFICATION\\n\\nSends email notification about created PO\\n\\nTO CONFIGURE:\\n1. Add SMTP credentials in n8n Settings\\n2. Set recipient email address\\n3. Customize email template if needed\\n\\nS"
      }
    },
    {
      "id": "2e6af9a9-6c12-4a76-a464-dc62d28df0dd",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -144,
        384
      ]
    },
    {
      "id": "2d8144d0-9217-41ba-a88a-717f7e1b04bd",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1552,
        -144
      ],
      "parameters": {
        "width": 208,
        "height": 720,
        "content": "**\"📤 SEND TO SUPPLIER\\n\\nSends purchase order to supplier's system via API\\n\\nTO CONFIGURE:\\n1. Replace URL with supplier API endpoint\\n2. Update Authorization token\\n3. Adjust body parameters to matc"
      }
    },
    {
      "id": "f36301eb-44bb-47d4-88e4-2cf81a7862e8",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1328,
        -96
      ],
      "parameters": {
        "width": 208,
        "height": 672,
        "content": "**\"📝 CREATE PURCHASE ORDER\\n\\nGenerates complete PO document\\n\\nThis code:\\n1. Creates unique PO number with timestamp\\n2. Calculates costs (quantity × unit cost)\\n3. Sets delivery date based on lead "
      }
    },
    {
      "id": "0437128d-5f64-4d49-8959-13dc61063aa5",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1104,
        32
      ],
      "parameters": {
        "width": 208,
        "height": 496,
        "content": "**\"🎯 FILTER: REORDER NEEDED\\n\\nOnly passes items where AI recommends reordering\\n\\nCondition: should_reorder === true\\n\\nItems that pass continue to PO creation\\nItems that fail are logged but no acti"
      }
    },
    {
      "id": "8d7b14bd-8b60-427d-8f6e-07ddc65c4f0f",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        896,
        0
      ],
      "parameters": {
        "width": 192,
        "height": 528,
        "content": "**\"🔍 PARSE AI RESPONSE\\n\\nExtracts and structures the AI forecast data\\n\\nThis code:\\n1. Parses JSON from AI response\\n2. Handles parsing errors gracefully\\n3. Combines forecast with original data\\n4."
      }
    },
    {
      "id": "3bc777c7-7bf4-4b9c-8f2b-842a8bb5abed",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        688,
        -80
      ],
      "parameters": {
        "width": 176,
        "height": 640,
        "content": "**\"🤖 AI DEMAND FORECASTING\\n\\nUses OpenAI GPT-4 to analyze data and forecast demand\\n\\nTO CONFIGURE:\\n1. Add OpenAI API credentials in n8n\\n2. Select model (gpt-4 or gpt-4-turbo)\\n3. Temperature is se"
      }
    },
    {
      "id": "36d7a838-5302-486f-867f-f1c07fb08465",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        480,
        -96
      ],
      "parameters": {
        "width": 160,
        "height": 672,
        "content": "*\"🔗 MERGE DATA\\n\\nCombines inventory and sales data into single dataset\\n\\nThis code:\\n1. Takes inventory data from first input\\n2. Takes sales data from second input\\n3. Matches products by product_i"
      }
    }
  ],
  "connections": {
    "Save to Database": {
      "main": [
        [
          {
            "node": "Send Notification Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Fetch Current Inventory",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log to ERP System": {
      "main": [
        [
          {
            "node": "Save to Database",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse AI Response": {
      "main": [
        [
          {
            "node": "Filter: Reorder Needed",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send PO to Supplier": {
      "main": [
        [
          {
            "node": "Log to ERP System",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Demand Forecasting": {
      "main": [
        [
          {
            "node": "Parse AI Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Purchase Order": {
      "main": [
        [
          {
            "node": "Send PO to Supplier",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter: Reorder Needed": {
      "main": [
        [
          {
            "node": "Create Purchase Order",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Current Inventory": {
      "main": [
        [
          {
            "node": "Fetch Sales Velocity",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge Inventory & Sales Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Inventory & Sales Data": {
      "main": [
        [
          {
            "node": "AI Demand Forecasting",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}