{
  "name": "Classify invoices and route them to Google Drive folders with easybits and Slack",
  "nodes": [
    {
      "id": "8f5c0ee5-d505-4bb2-9ffa-8723519e14e8",
      "name": "Extract from File",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        224,
        16
      ]
    },
    {
      "id": "0b1bbec4-90f6-43df-83a5-291f20df0afe",
      "name": "On form submission",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -64,
        16
      ]
    },
    {
      "id": "07e1cb4d-563e-4eb3-bfea-6abf4de90910",
      "name": "Edit Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        512,
        16
      ]
    },
    {
      "id": "ed7ca29a-3556-420e-aff1-5e5375b14d40",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -144,
        -160
      ],
      "parameters": {
        "width": 256,
        "height": 352,
        "content": "## 📋 Form Upload\nAccepts a file upload via a **web form**. Supports **PDF, PNG, and JPEG**."
      }
    },
    {
      "id": "f0a40bb8-4d2f-4a13-92e9-4d09176075b1",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        144,
        -160
      ],
      "parameters": {
        "width": 256,
        "height": 352,
        "content": "## 📄 Extract to Base64\nConverts the uploaded **binary file** into a base64-encoded string stored in `data`."
      }
    },
    {
      "id": "493e2722-9c17-49ed-9a2b-5deb701f0211",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        432,
        -160
      ],
      "parameters": {
        "width": 256,
        "height": 352,
        "content": "## 🔗 Build Data URI\nDynamically reads the **MIME type** from the uploaded file and prepends it as a base64 data URI."
      }
    },
    {
      "id": "6eb8b59f-56b2-4318-bc56-04e91da5877c",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1008,
        -160
      ],
      "parameters": {
        "width": 256,
        "height": 352,
        "content": "## 🔍 Parse Result\nExtracts **document_type** and **confidence_score** from the easybits API response into separate fields for downstream routing."
      }
    },
    {
      "id": "1e9361a2-9e7f-4301-a790-4a6c8afbae78",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1040,
        -688
      ],
      "parameters": {
        "width": 864,
        "height": 1408,
        "content": "# 📄 Invoice Classification Workflow\n(powered by easybits)\n\n## What This Workflow Does\nUpload a document (PDF, PNG, JPEG) via a web form and let **easybits Extractor** classify it into one of your defi"
      }
    },
    {
      "id": "e7f53509-9468-4238-b41f-092866d3532d",
      "name": "easybits Extractor (Classification)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        800,
        16
      ]
    },
    {
      "id": "c012a3af-1ded-4b54-b5dc-1db970f419a3",
      "name": "Parse Result",
      "type": "n8n-nodes-base.set",
      "position": [
        1088,
        16
      ]
    },
    {
      "id": "f976eacd-fbe6-4458-8d30-c712583ee6df",
      "name": "Category Router",
      "type": "n8n-nodes-base.switch",
      "position": [
        2016,
        -144
      ]
    },
    {
      "id": "29586299-5500-4e41-b4fa-d1e886f214dd",
      "name": "Confidence Check",
      "type": "n8n-nodes-base.if",
      "position": [
        1712,
        16
      ]
    },
    {
      "id": "e6ab1f14-9b14-4430-96ee-662440f29cb5",
      "name": "Upload to Review Folder",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        2304,
        624
      ]
    },
    {
      "id": "710bf76e-47a2-4a17-8bba-80520da84196",
      "name": "Upload to Telecom Folder",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        2304,
        224
      ]
    },
    {
      "id": "d412f0e2-3b97-4766-bf34-aa5643b5ea4e",
      "name": "Upload to Trades Folder",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        2304,
        16
      ]
    },
    {
      "id": "43c6a87b-c9bc-4507-8cee-55b01bf0118c",
      "name": "Upload to Hotel Folder",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        2304,
        -192
      ]
    },
    {
      "id": "3d3204ef-5e3c-4d60-8f39-a8825a5af10b",
      "name": "Upload to Restaurant Folder",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        2304,
        -384
      ]
    },
    {
      "id": "e68ac860-5d62-4ca9-ac22-2feb73ae4aa7",
      "name": "Upload to Medical Folder",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        2304,
        -576
      ]
    },
    {
      "id": "49d86462-b774-48a2-a2b3-18945573d2f1",
      "name": "Review Message",
      "type": "n8n-nodes-base.slack",
      "position": [
        2592,
        624
      ]
    },
    {
      "id": "0e5b6999-9a36-409b-96b1-04ae1bcaea6b",
      "name": "Attach Original File",
      "type": "n8n-nodes-base.merge",
      "position": [
        1392,
        416
      ]
    },
    {
      "id": "c99f2a8b-81f7-429b-a364-7e0de118e778",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        720,
        -160
      ],
      "parameters": {
        "width": 256,
        "height": 352,
        "content": "## 🚀 Send to easybits\nPOSTs the data URI to the **easybits Extractor API** pipeline for processing."
      }
    },
    {
      "id": "461b7856-9216-422a-9fb0-9285dd1c6c23",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1296,
        240
      ],
      "parameters": {
        "width": 288,
        "height": 352,
        "content": "## 🔗 Attach Original File\nMerges the classification result (JSON) with the original binary file from the form upload using **Combine by Position**, so downstream nodes have both the data and the file."
      }
    },
    {
      "id": "92bf3850-00d1-48e6-b0c4-675dac4ca2fa",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1616,
        -160
      ],
      "parameters": {
        "width": 288,
        "height": 352,
        "content": "## ✅ Confidence Check\nRoutes based on the **confidence_score**:\n- **> 0.5** → Category Router\n- **≤ 0.5** → Needs Review folder + Slack notification"
      }
    },
    {
      "id": "7bbd0e06-db14-417a-8104-91f915c833ea",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1936,
        -448
      ],
      "parameters": {
        "width": 256,
        "height": 592,
        "content": "## 🗂️ Category Router\nRoutes the invoice to the correct Google Drive folder based on **document_type**:\n\n1. `medical_invoice`\n2. `restaurant_invoice`\n3. `hotel_invoice`\n4. `trades_invoice`\n5. `telecom"
      }
    },
    {
      "id": "fdd6cc26-733d-4d3c-bc21-045f77ce2f1d",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2224,
        -752
      ],
      "parameters": {
        "width": 256,
        "height": 1168,
        "content": "## 📤 Upload to Google Drive Folders\nUploads the invoice to the **Medical** folder in Google Drive."
      }
    },
    {
      "id": "8a3e3022-72ef-4fa3-af18-4c2bae0f34dd",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2224,
        448
      ],
      "parameters": {
        "width": 256,
        "height": 352,
        "content": "## ⚠️ Upload to Review Folder\nUploads unclassified or low-confidence invoices to the **Needs Review** folder in Google Drive."
      }
    },
    {
      "id": "fade8cd4-bccb-4dd5-82d9-b99e936fdea8",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2512,
        448
      ],
      "parameters": {
        "width": 256,
        "height": 352,
        "content": "## 💬 Slack Notification\nSends a message to `#n8n-invoice-review` with the **document type**, **confidence score**, **file name**, and a direct **Google Drive link** so the team can manually classify t"
      }
    }
  ],
  "connections": {
    "Edit Fields": {
      "main": [
        [
          {
            "node": "easybits Extractor (Classification)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Result": {
      "main": [
        [
          {
            "node": "Attach Original File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Category Router": {
      "main": [
        [
          {
            "node": "Upload to Medical Folder",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Upload to Restaurant Folder",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Upload to Hotel Folder",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Upload to Trades Folder",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Upload to Telecom Folder",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Upload to Review Folder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Confidence Check": {
      "main": [
        [
          {
            "node": "Category Router",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Upload to Review Folder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract from File": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Extract from File",
            "type": "main",
            "index": 0
          },
          {
            "node": "Attach Original File",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Attach Original File": {
      "main": [
        [
          {
            "node": "Confidence Check",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload to Review Folder": {
      "main": [
        [
          {
            "node": "Review Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "easybits Extractor (Classification)": {
      "main": [
        [
          {
            "node": "Parse Result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}