{
  "name": "Automated Invoice Processing",
  "nodes": [
    {
      "parameters": {
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "filters": {
          "labelIds": []
        }
      },
      "id": "5e30749b-4327-4b80-abc1-1fe92295466d",
      "name": "Invoice Email",
      "type": "n8n-nodes-base.gmailTrigger",
      "typeVersion": 1.2,
      "position": [
        260,
        300
      ],
      "notes": "Assign Gmail credentials; filter your Invoices label."
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.ocr.space/parse/image",
        "sendBody": true
      },
      "id": "f611989a-c711-41d6-9700-e11d12c5ce2e",
      "name": "OCR Extract",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        560,
        300
      ],
      "notes": "Header Auth credential for your OCR provider."
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "26e01b4c-07fd-4b49-abbd-acb91f008c93",
              "name": "vendor",
              "value": "={{ $json.vendor }}",
              "type": "string"
            },
            {
              "id": "bf9ddef5-7e67-43a1-9c93-ca1cbc536644",
              "name": "amount",
              "value": "={{ $json.amount }}",
              "type": "number"
            }
          ]
        }
      },
      "id": "58606e24-57e9-4d6d-8383-d383ca88ba7a",
      "name": "Parse Fields",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        860,
        300
      ]
    },
    {
      "parameters": {
        "conditions": {
          "conditions": [
            {
              "id": "b4382d10-a9c8-475f-a96c-dda489c519ab",
              "leftValue": "={{ $json.amount }}",
              "rightValue": 5000,
              "operator": {
                "type": "number",
                "operation": "gt"
              }
            }
          ]
        }
      },
      "id": "8bf607e0-4f74-4e9e-bc2f-a2445f8b4a3e",
      "name": "Over 5000?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        1160,
        300
      ]
    },
    {
      "parameters": {
        "select": "channel",
        "text": "=Invoice needs approval: {{ $json.vendor }} - {{ $json.amount }}"
      },
      "id": "0a58c4b8-0543-40e2-b2ba-3a5a05730efa",
      "name": "Request Approval",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.3,
      "position": [
        260,
        520
      ]
    },
    {
      "parameters": {
        "resource": "bill",
        "operation": "create"
      },
      "id": "a6d9ee79-ef6c-400e-ab05-68a37a4582da",
      "name": "Post Bill",
      "type": "n8n-nodes-base.quickbooks",
      "typeVersion": 1,
      "position": [
        560,
        520
      ],
      "notes": "Assign QuickBooks Online credentials."
    },
    {
      "parameters": {
        "operation": "upload"
      },
      "id": "a2117585-24d3-45f3-8c5a-bf9bb5436c1a",
      "name": "Archive PDF",
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        860,
        520
      ],
      "notes": "Assign Google Drive credentials."
    }
  ],
  "connections": {
    "Invoice Email": {
      "main": [
        [
          {
            "node": "OCR Extract",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OCR Extract": {
      "main": [
        [
          {
            "node": "Parse Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Fields": {
      "main": [
        [
          {
            "node": "Over 5000?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Over 5000?": {
      "main": [
        [
          {
            "node": "Request Approval",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Post Bill",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Request Approval": {
      "main": [
        [
          {
            "node": "Post Bill",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Post Bill": {
      "main": [
        [
          {
            "node": "Archive PDF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {}
}
