{
  "name": "Automate invoice processing & stock management with AI, Gmail, Sheets & Slack",
  "nodes": [
    {
      "id": "c1e329c7-7a4b-4f43-a4de-4837bdc45a3b",
      "name": "Gmail Trigger",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        4000,
        544
      ]
    },
    {
      "id": "fc9966a6-7d22-4bf5-80d8-28aeb12d8d64",
      "name": "Extract from File",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        4224,
        544
      ]
    },
    {
      "id": "333f965f-f0c5-420d-b211-ae8216f60e32",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        4584,
        768
      ]
    },
    {
      "id": "fe863840-1c1f-4857-a4bd-388fbf86e124",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        4456,
        768
      ]
    },
    {
      "id": "86023db0-7c7e-4ff2-9a96-bf002453223f",
      "name": "Send a message",
      "type": "n8n-nodes-base.gmail",
      "position": [
        5696,
        448
      ]
    },
    {
      "id": "d33dc38e-679b-4d06-918c-aad95669d1cd",
      "name": "Extract Invoice Record",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        4448,
        544
      ]
    },
    {
      "id": "d094de77-6ec7-4271-a36f-d4ec3446ee74",
      "name": "Sales Order Creation",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        4800,
        544
      ]
    },
    {
      "id": "f9bc4f56-be77-4298-a16c-831f5c8ce827",
      "name": "Stock & Shortage Check",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        5056,
        544
      ]
    },
    {
      "id": "a288c427-f713-4d61-89d3-e9519bfea2f0",
      "name": "If Negative",
      "type": "n8n-nodes-base.if",
      "position": [
        5248,
        544
      ]
    },
    {
      "id": "df07b6d3-d71e-41b7-8f74-69d441f82696",
      "name": "Create Purchase Requisition",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        5472,
        448
      ]
    },
    {
      "id": "544667d2-f251-40f3-99fb-db9ff32df73e",
      "name": "Create  Work  Order",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        5472,
        640
      ]
    },
    {
      "id": "125d0e86-a4d6-4ee4-809f-d42e1b4d0488",
      "name": "Send Order Summary",
      "type": "n8n-nodes-base.slack",
      "position": [
        5696,
        640
      ]
    },
    {
      "id": "9950f0af-fa1a-4965-bd7c-2b5ddc3a5ee6",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3456,
        336
      ],
      "parameters": {
        "width": 450,
        "height": 496,
        "content": "## How it works\nThis workflow automates order procurement by monitoring Gmail for invoice PDFs. When an invoice arrives, AI extracts order details and checks inventory levels. If stock is sufficient, "
      }
    },
    {
      "id": "2ebf1cf1-b5ef-4b79-8b9f-9da78c0d1868",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3936,
        336
      ],
      "parameters": {
        "width": 1032,
        "height": 620,
        "content": "## Invoice Processing\nExtracts order data from PDF attachments using AI to structure customer info, SKU, quantity, and pricing."
      }
    },
    {
      "id": "ef95cae2-e583-4a2c-8333-61e5a710bdb0",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4992,
        336
      ],
      "parameters": {
        "width": 896,
        "height": 608,
        "content": "## Check stock availability or not\n- If available, then create a work order and notify via Slack.\n- In not available, then create a Purchase Requisition and send an email to the procurement team."
      }
    }
  ],
  "connections": {
    "If Negative": {
      "main": [
        [
          {
            "node": "Create Purchase Requisition",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Create  Work  Order",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail Trigger": {
      "main": [
        [
          {
            "node": "Extract from File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract from File": {
      "main": [
        [
          {
            "node": "Extract Invoice Record",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Extract Invoice Record",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Create  Work  Order": {
      "main": [
        [
          {
            "node": "Send Order Summary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sales Order Creation": {
      "main": [
        [
          {
            "node": "Stock & Shortage Check",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Invoice Record": {
      "main": [
        [
          {
            "node": "Sales Order Creation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Stock & Shortage Check": {
      "main": [
        [
          {
            "node": "If Negative",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Extract Invoice Record",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Create Purchase Requisition": {
      "main": [
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}