{
  "name": "Automate inventory replenishment and purchase orders with Mistral AI and ERP",
  "nodes": [
    {
      "id": "b36149ae-0be9-48a9-9f78-a3f3c430cdb6",
      "name": "Run inventory check every 6 hours",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        1200,
        -576
      ]
    },
    {
      "id": "c0c65c6d-fffb-44f8-be73-1d9ed2e4b73b",
      "name": "Query ERP for low stock items",
      "type": "n8n-nodes-base.postgres",
      "position": [
        1424,
        -576
      ]
    },
    {
      "id": "f9124775-b962-44cc-9085-d57a43c6ecf0",
      "name": "Fetch 90-day sales velocity data",
      "type": "n8n-nodes-base.postgres",
      "position": [
        1648,
        -576
      ]
    },
    {
      "id": "a23c9f1e-5edc-4f52-8f49-e1035a047295",
      "name": "Combine stock and sales data",
      "type": "n8n-nodes-base.merge",
      "position": [
        1872,
        -576
      ]
    },
    {
      "id": "a59003d0-86a9-4071-973b-f936e2e92970",
      "name": "Calculate sales velocity and stockout risk",
      "type": "n8n-nodes-base.code",
      "position": [
        2096,
        -576
      ]
    },
    {
      "id": "1a014efa-2e1c-4b7c-8889-60f8632bff79",
      "name": "Generate optimized purchase orders with Mistral AI",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        2376,
        -576
      ]
    },
    {
      "id": "d6889999-4f50-40b9-9ad7-e19639bbb404",
      "name": "Tool: Get supplier catalog",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        2576,
        -352
      ]
    },
    {
      "id": "21015b7d-d6c5-43a8-a4be-4fee097afa02",
      "name": "Tool: Check budget availability",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        2320,
        -352
      ]
    },
    {
      "id": "b3a325f3-83a1-461d-adb8-b7e1482f81c4",
      "name": "Parse and validate AI response",
      "type": "n8n-nodes-base.code",
      "position": [
        2784,
        -576
      ]
    },
    {
      "id": "7c81f63c-dbbf-4408-9d6a-5794440f0e21",
      "name": "Route based on approval criteria",
      "type": "n8n-nodes-base.if",
      "position": [
        3008,
        -576
      ]
    },
    {
      "id": "9b485c17-f4bb-4bd8-ad7c-ab88eb6576cc",
      "name": "Insert approved POs into ERP database",
      "type": "n8n-nodes-base.postgres",
      "position": [
        3232,
        -672
      ]
    },
    {
      "id": "09c226ba-ffae-467d-818a-ccb3f6fc95eb",
      "name": "Update inventory with pending orders",
      "type": "n8n-nodes-base.postgres",
      "position": [
        3456,
        -672
      ]
    },
    {
      "id": "5fc35c33-ee54-4592-b04b-6cf902469819",
      "name": "Group purchase orders by supplier",
      "type": "n8n-nodes-base.code",
      "position": [
        3680,
        -672
      ]
    },
    {
      "id": "d0860da8-af85-4cec-a78b-5a79512cbb43",
      "name": "Email purchase order to supplier",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        3904,
        -672
      ]
    },
    {
      "id": "d720c6c4-4958-4f19-9905-ccca3bac9918",
      "name": "Create audit log for compliance",
      "type": "n8n-nodes-base.postgres",
      "position": [
        4128,
        -672
      ]
    },
    {
      "id": "a2f03549-544c-476b-a4a9-724b8caa3f66",
      "name": "Send summary notification to Slack",
      "type": "n8n-nodes-base.slack",
      "position": [
        4352,
        -672
      ]
    },
    {
      "id": "4ee8b65b-3bb3-49e8-8143-ed184f7b2e3b",
      "name": "Flag for manager approval",
      "type": "n8n-nodes-base.set",
      "position": [
        3232,
        -480
      ]
    },
    {
      "id": "c5d69cdb-4e01-4e68-a028-c6c90191aa60",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        416,
        -1040
      ],
      "parameters": {
        "width": 612,
        "height": 1040,
        "content": "## Automate inventory replenishment with AI demand forecasting and Mistral\n\nMonitor warehouse stock levels, forecast demand with Mistral AI, and automatically generate and send optimized purchase orde"
      }
    },
    {
      "id": "8548fa90-66dc-4aad-8e1f-9ce73f4a0bce",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1136,
        -848
      ],
      "parameters": {
        "width": 672,
        "height": 596,
        "content": "## 1. Data collection\n\nFetches low-stock items and sales history"
      }
    },
    {
      "id": "521e3c3d-02e9-4abd-9949-808a3ef4e0f1",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1840,
        -768
      ],
      "parameters": {
        "width": 1056,
        "height": 596,
        "content": "## 2. AI analysis and forecasting\n\nMistral AI analyzes data and creates optimized POs"
      }
    },
    {
      "id": "aa58e39a-743c-4dc7-a3c4-7f6830e20678",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2928,
        -932
      ],
      "parameters": {
        "width": 480,
        "height": 612,
        "content": "## 3. Approval and ERP sync\n\nAuto-approves qualifying orders, logs in ERP"
      }
    },
    {
      "id": "8f4384f9-4d30-4cb4-81d4-6ec31d50707c",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3440,
        -944
      ],
      "parameters": {
        "width": 1120,
        "height": 612,
        "content": "## 4. Communication and logging\n\nEmails suppliers, creates audit trail, notifies team"
      }
    },
    {
      "id": "82713cd2-28c1-48b6-aefb-73acd57a01e5",
      "name": "Mistral AI language model",
      "type": "@n8n/n8n-nodes-langchain.lmChatMistralCloud",
      "position": [
        2448,
        -352
      ]
    }
  ],
  "connections": {
    "Mistral AI language model": {
      "ai_languageModel": [
        [
          {
            "node": "Generate optimized purchase orders with Mistral AI",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Tool: Get supplier catalog": {
      "ai_tool": [
        [
          {
            "node": "Generate optimized purchase orders with Mistral AI",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Combine stock and sales data": {
      "main": [
        [
          {
            "node": "Calculate sales velocity and stockout risk",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Query ERP for low stock items": {
      "main": [
        [
          {
            "node": "Fetch 90-day sales velocity data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse and validate AI response": {
      "main": [
        [
          {
            "node": "Route based on approval criteria",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create audit log for compliance": {
      "main": [
        [
          {
            "node": "Send summary notification to Slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Tool: Check budget availability": {
      "ai_tool": [
        [
          {
            "node": "Generate optimized purchase orders with Mistral AI",
            "type": "ai_tool",
            "index": 1
          }
        ]
      ]
    },
    "Email purchase order to supplier": {
      "main": [
        [
          {
            "node": "Create audit log for compliance",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch 90-day sales velocity data": {
      "main": [
        [
          {
            "node": "Combine stock and sales data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route based on approval criteria": {
      "main": [
        [
          {
            "node": "Insert approved POs into ERP database",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Flag for manager approval",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Group purchase orders by supplier": {
      "main": [
        [
          {
            "node": "Email purchase order to supplier",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run inventory check every 6 hours": {
      "main": [
        [
          {
            "node": "Query ERP for low stock items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update inventory with pending orders": {
      "main": [
        [
          {
            "node": "Group purchase orders by supplier",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Insert approved POs into ERP database": {
      "main": [
        [
          {
            "node": "Update inventory with pending orders",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculate sales velocity and stockout risk": {
      "main": [
        [
          {
            "node": "Generate optimized purchase orders with Mistral AI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate optimized purchase orders with Mistral AI": {
      "main": [
        [
          {
            "node": "Parse and validate AI response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}