{
  "name": "Automated invoice processing system with OCR & AI - AP automation with Airtable",
  "nodes": [
    {
      "id": "7076854e-c7e8-45b5-9e5e-16678bffa254",
      "name": "OpenAI Model",
      "type": "@n8n/n8n-nodes-langchain.lmOpenAi",
      "position": [
        980,
        1380
      ]
    },
    {
      "id": "00819f1c-2c60-4b7c-b395-445ec05fd898",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1160,
        1380
      ]
    },
    {
      "id": "1acf2c60-c2b9-4f78-94a4-0711c8bd71ab",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -340,
        100
      ],
      "parameters": {
        "width": 760,
        "height": 533,
        "content": "# Invoice Processing Automation\n\n### This template is the automation behind a simple incoming invoice automation tool (AP automation) tool built in Airtable.\n\n### Follow the instructions below to get "
      }
    },
    {
      "id": "5f9b507f-4dc1-4853-bf71-a64f2f4b55c1",
      "name": "Map Output",
      "type": "n8n-nodes-base.set",
      "position": [
        1320,
        1220
      ]
    },
    {
      "id": "d22744cd-151d-4b92-b4f2-4a5b9ceb4ee7",
      "name": "Apply Data Extraction Rules",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        980,
        1220
      ]
    },
    {
      "id": "31b27190-bf01-4d2a-82ad-621e89bfbf6f",
      "name": "Gmail1",
      "type": "n8n-nodes-base.gmail",
      "position": [
        820,
        520
      ]
    },
    {
      "id": "955fd212-11f7-4b2d-8e5c-a297509cbf08",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        760,
        360
      ],
      "parameters": {
        "width": 230,
        "height": 280,
        "content": "Gets all messages that:\n1) Have an attachment\n2) Do not have the label invoice_checked\n3) Text matches invoice"
      }
    },
    {
      "id": "712495a2-0c3d-452b-bd10-b19f6bea2178",
      "name": "Get all img_url",
      "type": "n8n-nodes-base.set",
      "position": [
        1620,
        520
      ]
    },
    {
      "id": "caa879e0-54c5-40c8-83b2-b59b1b74af67",
      "name": "Analyze image",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        660,
        1220
      ]
    },
    {
      "id": "b0052237-4129-460f-ae38-69680760c78b",
      "name": "Get image data",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1360,
        520
      ]
    },
    {
      "id": "f7752ed2-5497-42a9-ab41-4fcee7faf52a",
      "name": "PDF -> JPG - ConvertAPI",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1120,
        520
      ]
    },
    {
      "id": "0625e6f0-d8ed-469e-a551-e82225a97144",
      "name": "Get list of vendors",
      "type": "n8n-nodes-base.airtable",
      "position": [
        1020,
        820
      ]
    },
    {
      "id": "6d808c56-0449-43c8-afdb-2097a240ef87",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        1480,
        800
      ]
    },
    {
      "id": "c7d36fae-d497-4ed2-be0f-2b2a699fb9f6",
      "name": "Edit Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        1220,
        820
      ]
    },
    {
      "id": "69fbdb0d-8eff-4de2-bb9c-8261ebe7f67a",
      "name": "Information Extractor",
      "type": "@n8n/n8n-nodes-langchain.informationExtractor",
      "position": [
        1700,
        1320
      ]
    },
    {
      "id": "134cb237-5500-4575-802a-ae8759104f92",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1720,
        1500
      ]
    },
    {
      "id": "4b32647c-1521-4279-8223-dbbc1c1eb714",
      "name": "Merge1",
      "type": "n8n-nodes-base.merge",
      "position": [
        2240,
        700
      ]
    },
    {
      "id": "6ad25f9f-f1e5-4468-9862-b0c93bc9b19d",
      "name": "Airtable",
      "type": "n8n-nodes-base.airtable",
      "position": [
        2480,
        700
      ]
    },
    {
      "id": "9e775f8d-4af5-4212-8c65-36e3e5c161f2",
      "name": "Gmail Trigger",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        580,
        520
      ]
    },
    {
      "id": "39afb11e-f98a-4d50-b31c-4b1806b6e483",
      "name": "Gmail",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2680,
        700
      ]
    },
    {
      "id": "ce68d5b8-1532-459f-b6fe-33f46e3f9186",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -340,
        660
      ],
      "parameters": {
        "width": 440,
        "height": 460,
        "content": "# *1. Set up Airtable*\n\n## 1 - [Register an Airtable account here](https://airtable.partnerlinks.io/xfs4x6q28m4x)\n\n## 2 - Duplicate [this base](https://airtable.com/appFMuGzhsUxbFKUh/shrOP5l52wxZ5IYSI"
      }
    },
    {
      "id": "89c5f457-fe92-43d2-b4ca-7cd5624f5cb1",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -340,
        1140
      ],
      "parameters": {
        "width": 440,
        "height": 420,
        "content": "# 2. Set Up ConvertAPI\n\n## 1 - [Register a ConvertAPI account here](https://convertapi.com?ref=cq5du)\n\n## 2 - Get an API key, and save it somewhere safe\n\n## 3 - Create a Header Auth credential in Cred"
      }
    },
    {
      "id": "896d3cd8-079e-4976-ae6b-61b73cd8c100",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2420,
        600
      ],
      "parameters": {
        "width": null,
        "height": 100,
        "content": "### TODO: Change the Base to the duplicated base, and the table to \"Invoices\""
      }
    },
    {
      "id": "92a526d0-c116-4b1e-9ad2-5c1f45e0a6b8",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        960,
        960
      ],
      "parameters": {
        "width": null,
        "height": 100,
        "content": "### TODO: Change the Base to the duplicated base, and the table to \"Vendors\""
      }
    },
    {
      "id": "f4635b8b-25d5-4e23-af98-0d2d25040d90",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -340,
        1580
      ],
      "parameters": {
        "width": 440,
        "height": 420,
        "content": "# 3. Set up Gmail\n\n## 1 - Create the \"invoice_checked\" label\n\n## 2 - [Follow the instructions](https://docs.n8n.io/integrations/builtin/credentials/google/oauth-single-service/#finish-your-n8n-credent"
      }
    },
    {
      "id": "903f5ee9-fde9-4225-949f-d02b0e820bbd",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -340,
        2020
      ],
      "parameters": {
        "width": 440,
        "height": 220,
        "content": "# 4. Set up OpenAI\n\n## Follow the [n8n instructions](https://docs.n8n.io/integrations/builtin/credentials/openai/) to connect your OpenAI platform account."
      }
    },
    {
      "id": "58c3cdaf-3912-40d3-9b95-8b610ae95540",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1040,
        440
      ],
      "parameters": {
        "width": null,
        "height": 100,
        "content": "### TODO: Add the ConvertAPI Header Auth"
      }
    },
    {
      "id": "ac79181d-0434-4be0-8f5f-173255064b96",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        460,
        -100
      ],
      "parameters": {
        "width": 760,
        "height": 420,
        "content": "# Made by:\n## Milan @ SmoothWork - [Book a Free Consulting Call](https://smoothwork.ai/book-a-call/)\n![Milan](https://gravatar.com/avatar/95700d17ba300a9f14c1b8cacf933df7720027b3adda9cbe6183d891429254"
      }
    },
    {
      "id": "eb3d40d0-6f5b-4fac-bf16-668c2fd90e07",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        120,
        660
      ],
      "parameters": {
        "width": 400,
        "height": 280,
        "content": "# Video Introduction\n[![image.png](https://i.ytimg.com/vi/rfu4MSvtpAw/hqdefault.jpg?sqp=-oaymwEnCNACELwBSFryq4qpAxkIARUAAIhCGAHYAQHiAQoIGBACGAY4AUAB&rs=AOn4CLCRFYblexOaD3MYHJ7QFgjTPfwfVA)](https://www"
      }
    }
  ],
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "Information Extractor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail1": {
      "main": [
        [
          {
            "node": "PDF -> JPG - ConvertAPI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge1": {
      "main": [
        [
          {
            "node": "Airtable",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Airtable": {
      "main": [
        [
          {
            "node": "Gmail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Map Output": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          },
          {
            "node": "Merge1",
            "type": "main",
            "index": 2
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Model": {
      "ai_languageModel": [
        [
          {
            "node": "Apply Data Extraction Rules",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Analyze image": {
      "main": [
        [
          {
            "node": "Apply Data Extraction Rules",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail Trigger": {
      "main": [
        [
          {
            "node": "Gmail1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get image data": {
      "main": [
        [
          {
            "node": "Get all img_url",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get all img_url": {
      "main": [
        [
          {
            "node": "Analyze image",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Information Extractor",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Get list of vendors": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Information Extractor": {
      "main": [
        [
          {
            "node": "Merge1",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "PDF -> JPG - ConvertAPI": {
      "main": [
        [
          {
            "node": "Get image data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Apply Data Extraction Rules",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Apply Data Extraction Rules": {
      "main": [
        [
          {
            "node": "Map Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}