{
  "name": "Extract invoice data from Gmail PDFs to JSON, Google Sheets and Airtable",
  "nodes": [
    {
      "id": "8c8ca031-b331-45e8-954a-67256d21895d",
      "name": "Sticky_Intake",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        256,
        -224
      ],
      "parameters": {
        "width": 466,
        "height": 330,
        "content": "## 📥 PHASE 1: Intake & Validation\nTriggers on Gmail attachments. Validates PDF format, filters out non-invoice emails, and performs initial data quality checks."
      }
    },
    {
      "id": "41d5378a-b652-4229-94a0-ba00dcd853e1",
      "name": "Sticky_Parsing",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        736,
        -224
      ],
      "parameters": {
        "width": 550,
        "height": 362,
        "content": "## 🔬 PHASE 2: AI Parsing & Extraction\n**Parse PDF to JSON:** Converts binary PDF to structured data. **AI Ledger Mapper:** Extracts financial fields with intelligent pattern matching and confidence sc"
      }
    },
    {
      "id": "69631f3b-3285-49ac-80e1-364df5c6c6d1",
      "name": "Sticky_Sync",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1312,
        -368
      ],
      "parameters": {
        "width": 650,
        "height": 650,
        "content": "## 🚀 PHASE 3: Ledger Sync & Archival\nUpdates Google Sheets ledger, creates Airtable records, archives to Drive. High-value or low-confidence items trigger Slack escalations for manual review."
      }
    },
    {
      "id": "69ed7655-68d0-4266-beab-2c715f24f648",
      "name": "Sticky_ReviewQueue",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1312,
        352
      ],
      "parameters": {
        "width": 578,
        "height": 350,
        "content": "## ⚠️ PHASE 4: Review Queue\nLow confidence scores (<0.7) or high-value invoices (>$5000) require manual approval before final posting."
      }
    },
    {
      "id": "23803aa6-c52d-4c26-a617-4e979a82d69f",
      "name": "Gmail: Watch Invoices",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        320,
        -64
      ]
    },
    {
      "id": "8d464849-1f13-4476-a6d8-aca8768f5e65",
      "name": "IF: Valid PDF Attachment",
      "type": "n8n-nodes-base.if",
      "position": [
        480,
        -64
      ]
    },
    {
      "id": "9ceec5e8-db65-45fc-8a25-113ccab7f9de",
      "name": "Code: Pre-Processor",
      "type": "n8n-nodes-base.code",
      "position": [
        640,
        -64
      ]
    },
    {
      "id": "46fec074-98c4-4b8b-814f-d7609ce7619f",
      "name": "HTML to PDF: Parse to JSON",
      "type": "n8n-nodes-htmlcsstopdf.htmlcsstopdf",
      "position": [
        816,
        -64
      ]
    },
    {
      "id": "01d6530b-1b4b-45df-a9ca-39457bd9a87c",
      "name": "Code: AI Ledger Mapper",
      "type": "n8n-nodes-base.code",
      "position": [
        976,
        -64
      ]
    },
    {
      "id": "2f7df52f-a24c-4323-b275-9b2faf4f83ed",
      "name": "IF: Auto-Approve",
      "type": "n8n-nodes-base.if",
      "position": [
        1136,
        -64
      ]
    },
    {
      "id": "9ed956df-b1a5-4756-91e7-b2fb13354242",
      "name": "Google Sheets: Add Row",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1424,
        -240
      ]
    },
    {
      "id": "17a425a2-a110-4798-b4fc-b307be2ec658",
      "name": "Airtable: Create Record",
      "type": "n8n-nodes-base.airtable",
      "position": [
        1424,
        -80
      ]
    },
    {
      "id": "45f0dd21-60cb-4542-9d07-30114e2a69c1",
      "name": "Google Drive: Archive Invoice",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1424,
        80
      ]
    },
    {
      "id": "4f5a2de1-9ad5-4e10-bc0a-c0f774ee9789",
      "name": "Slack: Success Notification",
      "type": "n8n-nodes-base.slack",
      "position": [
        1632,
        -48
      ]
    },
    {
      "id": "95f9207e-2c14-40fc-a2e2-61ebff886a3f",
      "name": "Slack: Review Required",
      "type": "n8n-nodes-base.slack",
      "position": [
        1360,
        464
      ]
    },
    {
      "id": "72e9a7e4-5a64-4068-9da5-c3af5ee35751",
      "name": "Google Sheets: Review Queue",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1552,
        480
      ]
    },
    {
      "id": "23726aef-e060-43f0-8786-516092fd7bc0",
      "name": "Gmail: Review Alert",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1728,
        464
      ]
    },
    {
      "id": "f04e30d3-7349-4042-9832-5d06d54d1244",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -272,
        -992
      ],
      "parameters": {
        "width": 448,
        "height": 704,
        "content": "## 💰 Autonomous Invoice Extraction Hub (v11.0)\n\nIndustrial-grade pipeline for automated financial data entry: Gmail → JSON Parsing → AI Ledger Mapping → Multi-Tier Sync.\n\n### ⚙️ Core Sovereign Logic\n*"
      }
    }
  ],
  "connections": {
    "IF: Auto-Approve": {
      "main": [
        [
          {
            "node": "Google Sheets: Add Row",
            "type": "main",
            "index": 0
          },
          {
            "node": "Airtable: Create Record",
            "type": "main",
            "index": 0
          },
          {
            "node": "Google Drive: Archive Invoice",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Slack: Review Required",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code: Pre-Processor": {
      "main": [
        [
          {
            "node": "HTML to PDF: Parse to JSON",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code: AI Ledger Mapper": {
      "main": [
        [
          {
            "node": "IF: Auto-Approve",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Slack: Review Required": {
      "main": [
        [
          {
            "node": "Google Sheets: Review Queue",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF: Valid PDF Attachment": {
      "main": [
        [
          {
            "node": "Code: Pre-Processor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTML to PDF: Parse to JSON": {
      "main": [
        [
          {
            "node": "Code: AI Ledger Mapper",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets: Review Queue": {
      "main": [
        [
          {
            "node": "Gmail: Review Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Drive: Archive Invoice": {
      "main": [
        [
          {
            "node": "Slack: Success Notification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}