{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "78bb4afe-ccc6-4b5e-90ba-50253f761f14",
      "name": "Split Attachments",
      "type": "n8n-nodes-base.code",
      "position": [
        -80,
        140
      ],
      "parameters": {
        "jsCode": "let results = [];\n\nfor (const item of $input.all()) {\n    for (key of Object.keys(item.binary)) {\n        results.push({\n            json: {\n                fileName: item.binary[key].fileName\n            },\n            binary: {\n                data: item.binary[key],\n            }\n        });\n    }\n}\n\nreturn results;"
      },
      "typeVersion": 2
    },
    {
      "id": "48a79e8c-27c2-4cdb-a6f7-241158c10962",
      "name": "Download Attachments",
      "type": "n8n-nodes-base.microsoftOutlook",
      "position": [
        -260,
        140
      ],
      "parameters": {
        "options": {
          "downloadAttachments": true
        },
        "messageId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        },
        "operation": "get"
      },
      "credentials": {
        "microsoftOutlookOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "7dda1618-dfa7-4325-b5ff-7935602a3043",
      "name": "Parse Output",
      "type": "n8n-nodes-base.set",
      "position": [
        680,
        400
      ],
      "parameters": {
        "mode": "raw",
        "options": {},
        "jsonOutput": "={{\n{\n  invoice: $json.candidates[0].content.parts[0].text.parseJson(),\n  email: {\n    ...$('Message Ref').first().json,\n    body: null\n  }\n}\n}}"
      },
      "typeVersion": 3.4
    },
    {
      "id": "4d45cf33-5a14-4fe4-9485-38de901113aa",
      "name": "For Each Message",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -640,
        140
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "b5c70065-3ed8-4024-9a10-247810c062a4",
      "name": "Message Ref",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -440,
        140
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "cafcf919-25c3-46bd-8dd3-8cc0201c93cb",
      "name": "Message Classifier",
      "type": "@n8n/n8n-nodes-langchain.textClassifier",
      "position": [
        -1160,
        140
      ],
      "parameters": {
        "options": {
          "fallback": "other"
        },
        "inputText": "=from: {{ $json.from.emailAddress.address }} <{{ $json.from.emailAddress.address }}>\nsubject: {{ $json.subject }}\n<message>\n{{ $json.markdown.split('\\n**From**')[0].trim() }}\n</message>",
        "categories": {
          "categories": [
            {
              "category": "invoice",
              "description": "Message is an invoice is being issued"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f97f9b24-828b-4dd8-a0e8-b7ab670403a8",
      "name": "Extract from File",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        -440,
        340
      ],
      "parameters": {
        "options": {},
        "operation": "binaryToPropery"
      },
      "typeVersion": 1
    },
    {
      "id": "99d49549-af7c-46aa-b321-2b9955333812",
      "name": "Markdown",
      "type": "n8n-nodes-base.markdown",
      "position": [
        -1340,
        140
      ],
      "parameters": {
        "html": "={{ $json.body.content }}",
        "options": {},
        "destinationKey": "markdown"
      },
      "typeVersion": 1
    },
    {
      "id": "18455ee7-e87b-433c-baef-28444358e486",
      "name": "Empty Response",
      "type": "n8n-nodes-base.set",
      "position": [
        680,
        600
      ],
      "parameters": {
        "mode": "raw",
        "options": {},
        "jsonOutput": "={{\n{\n  invoice: null,\n  email: {\n    ...$('Message Ref').first().json,\n    body: null\n  }\n}\n}}"
      },
      "typeVersion": 3.4
    },
    {
      "id": "d0b4bab2-5955-4d05-8e4f-4a23fac98c45",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        880,
        600
      ],
      "parameters": {
        "amount": 1
      },
      "typeVersion": 1.1
    },
    {
      "id": "2600020d-9751-44df-abcd-48026c21f592",
      "name": "Filter Invoices",
      "type": "n8n-nodes-base.filter",
      "position": [
        -80,
        340
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "5240de52-3b02-4151-8c2b-b0522582700e",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{\n(function(output) {\n  return output.is_invoice && output.is_issued_to_company;\n})(\n  $json.candidates[0].content.parts[0].text.parseJson()\n)\n}}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2,
      "alwaysOutputData": true
    },
    {
      "id": "b31d359e-d949-4d56-b32e-c49b35124ff7",
      "name": "Has Invoice?",
      "type": "n8n-nodes-base.if",
      "position": [
        280,
        400
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "57f433cd-5861-434f-80f2-ce28d7c22c26",
              "operator": {
                "type": "object",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $input.first().json }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "857e2282-d7f7-438b-be87-a1c36986cfc0",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -1820,
        120
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "7292a6cc-3b59-4d9b-b87d-3ba55bbc0c67",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -780,
        -120
      ],
      "parameters": {
        "color": 7,
        "width": 950,
        "height": 680,
        "content": "## 2. \ucca8\ubd80 \ud30c\uc77c\uc774 \uc1a1\uc7a5\uc778\uc9c0 \ubd84\ub958\ud558\uae30  \n[Outlook \ub178\ub4dc\uc5d0 \ub300\ud574 \ub354 \uc54c\uc544\ubcf4\uae30](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.microsoftoutlook)  \n\n\uac01 \uc790\uaca9\uc744 \uac16\ucd98 \uba54\uc2dc\uc9c0\uc5d0 \ub300\ud574, \ud3ec\ud568\ub41c \ucca8\ubd80 \ud30c\uc77c \uc911 \uc5b4\ub5a4 \uac83\uc774 \uc2e4\uc81c \uc1a1\uc7a5 \ubb38\uc11c\uc778\uc9c0 \uc54c\uc544\uc57c \ud569\ub2c8\ub2e4. \uc774\ub97c \uc704\ud574 Google Gemini\uc758 \ubb38\uc11c \uc774\ud574 \uae30\ub2a5\uc744 \uc0ac\uc6a9\ud558\uc5ec \uc774\ub97c \uac80\uc99d\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \uc774 \uacbd\uc6b0 Gemini\ub97c \ud2b9\ubcc4\ud788 \uc0ac\uc6a9\ud558\ub294 \uc774\uc720\ub294, \uc791\uc131 \uc2dc\uc810\uc5d0\uc11c Gemini\uac00 \ud604\uc7ac PDF \ubb38\uc11c\ub97c \uc218\uc6a9\ud558\ub294 \uba87 \uc548 \ub418\ub294 LLM \uc81c\uacf5\uc790 \uc911 \uc720\uc77c\ud55c \uac83\uc774\uae30 \ub54c\ubb38\uc785\ub2c8\ub2e4. Gemini\ub97c \uc0ac\uc6a9\ud558\uc9c0 \uc54a\ub294 \uacbd\uc6b0, \uba3c\uc800 PDF \ubb38\uc11c\ub97c \uc774\ubbf8\uc9c0\ub85c \ubcc0\ud658\ud574\uc57c \ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4 - [\uc774 \uc608\uc2dc\ub97c \uc5ec\uae30\uc5d0\uc11c \ud655\uc778\ud558\uc138\uc694](https://n8n.io/workflows/2421-transcribing-bank-statements-to-markdown-using-gemini-vision-ai/)."
      },
      "typeVersion": 1
    },
    {
      "id": "ed35c1dc-625d-4ffb-b186-fad514f6df81",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        200,
        180
      ],
      "parameters": {
        "color": 7,
        "width": 850,
        "height": 580,
        "content": "## 3. \uc778\ubcf4\uc774\uc2a4 \uc138\ubd80 \uc815\ubcf4 \ucd94\ucd9c\n\n[HTTP Request \ub178\ub4dc\uc5d0 \ub300\ud574 \uc790\uc138\ud788 \uc54c\uc544\ubcf4\uae30](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.httprequest/)\n\n\uc778\ubcf4\uc774\uc2a4 PDF\uac00 \uc900\ube44\ub418\uc5c8\uc73c\ubbc0\ub85c, Gemini API\ub97c \ub2e4\uc2dc \uc0ac\uc6a9\ud558\uc5ec \uadf8\ub4e4\ub85c\ubd80\ud130 \ud544\uc694\ud55c \uc138\ubd80 \uc815\ubcf4\ub97c \ucd94\ucd9c\ud558\uaca0\uc2b5\ub2c8\ub2e4. \ubd88\ud589\ud788\ub3c4, Gemini\ub294 API\uc758 \"generationConfig\" \ub9e4\uac1c\ubcc0\uc218\ub97c \uc0ac\uc6a9\ud560 \ub54c \ub370\uc774\ud130 \ucd94\ucd9c\uc5d0 \uac00\uc7a5 \uc798 \uc791\ub3d9\ud558\ub294\ub370, \uc774\ub294 n8n\uc758 \uae30\ubcf8 AI \ub178\ub4dc\uc5d0\uc11c \uc9c0\uc6d0\ub418\uc9c0 \uc54a\uae30 \ub54c\ubb38\uc5d0 HTTP request \ub178\ub4dc\ub97c \uc0ac\uc6a9\ud558\uace0 \uc788\uc2b5\ub2c8\ub2e4. \uadf8 \ud6c4, \ucd9c\ub825\uc740 \uc6d0\ubcf8 \uc774\uba54\uc77c\uacfc \ubcd1\ud569\ub418\uc5b4 \uadf8\ub4e4 \uc0ac\uc774\uc758 \ucc38\uc870\ub97c \uc720\uc9c0\ud569\ub2c8\ub2e4."
      },
      "typeVersion": 1
    },
    {
      "id": "42a9036c-8040-41a7-9366-658ba3e31c70",
      "name": "Get Recent Messages",
      "type": "n8n-nodes-base.microsoftOutlook",
      "position": [
        -1540,
        140
      ],
      "parameters": {
        "fields": [
          "body",
          "categories",
          "conversationId",
          "from",
          "hasAttachments",
          "internetMessageId",
          "sender",
          "subject",
          "toRecipients",
          "receivedDateTime",
          "webLink"
        ],
        "output": "fields",
        "options": {},
        "filtersUI": {
          "values": {
            "filters": {
              "receivedAfter": "={{ $now.minus({ \"hour\": 1 }).toISO() }}",
              "hasAttachments": true,
              "foldersToInclude": [
                "AAMkAGZkNmEzOTVhLTk3NDQtNGQzNi1hNDY2LTE2MWFlMzUyNTczMgAuAAAAAAA27qsaXv92QoGqcRnqoMpSAQDhSgSaDoa3Sp4gzAabpsdOAAAAAAEMAAA="
              ]
            }
          }
        },
        "operation": "getAll",
        "returnAll": true
      },
      "credentials": {
        "microsoftOutlookOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "86838ba4-0d57-4571-983f-c17005f39333",
      "name": "Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -1080,
        280
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.0-flash"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "8ecb7298-3512-40fe-b2bc-70fb4ed5965d",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1620,
        -120
      ],
      "parameters": {
        "color": 7,
        "width": 810,
        "height": 560,
        "content": "## 1. \uc1a1\uc7a5 \uc774\uba54\uc77c \ud655\uc778\n\n[\ud14d\uc2a4\ud2b8 \ubd84\ub958\uae30 \ub178\ub4dc\uc5d0 \ub300\ud574 \uc790\uc138\ud788 \uc54c\uc544\ubcf4\uae30](https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.text-classifier/)\n\nOutlook \ub178\ub4dc\ub294 \uc9c0\ub09c 1\uc2dc\uac04 \uc774\ub0b4\uc758 \ubaa8\ub4e0 \ubc1b\uc740 \ud3b8\uc9c0\ud568 \uba54\uc2dc\uc9c0\ub97c \uac00\uc838\uc624\uace0, \ucca8\ubd80 \ud30c\uc77c\uc744 \ub2e4\uc6b4\ub85c\ub4dc\ud558\uae30 \uc804\uc5d0 \uac01 \uba54\uc2dc\uc9c0\ub97c \ubd84\ub958\ud569\ub2c8\ub2e4. \uc774\uac83\uc740 \uc790\uc6d0 \uc18c\ube44\ub97c \uc904\uc774\uae30 \uc704\ud55c \uc815\ub9d0 \uc88b\uc740 \ucd08\uae30 \ud655\uc778\uc785\ub2c8\ub2e4. \uc774 \uc0ac\uc6a9 \uc0ac\ub840\uc5d0\uc11c, \uc774\uba54\uc77c \uc758\ub3c4\ub97c \uc704\ud55c \ub9e5\ub77d\uc801 \ucd94\ub860\uc5d0 AI\ub97c \uc0ac\uc6a9\ud558\ub294 \uac83\uc740 \ub2e8\uc21c\ud55c \ud0a4\uc6cc\ub4dc \ub9e4\uce6d\ubcf4\ub2e4 \ud6e8\uc52c \ub354 \uac15\ub825\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \ud6c4\uc790\ub294 \uc624\ud0d0\uc9c0(false positives)\uc5d0 \ub354 \ucde8\uc57d\ud569\ub2c8\ub2e4.\n\n*\ub178\ud2b8: Outlook Trigger \ub178\ub4dc\ub97c \uc0ac\uc6a9\ud558\uc9c0 \uc54a\ub294 \uc774\uc720\ub294 dateTime \ud544\ud130\ub97c \uc124\uc815\ud560 \uc218 \uc5c6\uae30 \ub54c\ubb38\uc785\ub2c8\ub2e4.*"
      },
      "typeVersion": 1
    },
    {
      "id": "a3c28ab3-ecab-46fd-86bb-62bf8a222f37",
      "name": "Microsoft Excel 365",
      "type": "n8n-nodes-base.microsoftExcel",
      "position": [
        420,
        -40
      ],
      "parameters": {
        "options": {},
        "fieldsUi": {
          "values": [
            {}
          ]
        },
        "resource": "worksheet",
        "workbook": {
          "__rl": true,
          "mode": "id",
          "value": "ABCDEFGHIJ"
        },
        "operation": "append",
        "worksheet": {
          "__rl": true,
          "mode": "id",
          "value": "{00000000-0001-0000-0000-000000000000}"
        }
      },
      "credentials": {
        "microsoftExcelOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "69f2a975-ab91-4cbc-be72-633c4601bf6f",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        200,
        -220
      ],
      "parameters": {
        "color": 7,
        "width": 530,
        "height": 380,
        "content": "## 4. Excel \ud1b5\ud569 \ubb38\uc11c\uc5d0 \uc5c5\ub85c\ub4dc\n\n[Excel \ub178\ub4dc\uc5d0 \ub300\ud574 \ub354 \uc54c\uc544\ubcf4\uae30](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.microsoftexcel/)\n\n\ub9c8\uc9c0\ub9c9\uc73c\ub85c \ub370\uc774\ud130\ub97c \ucea1\ucc98\ud558\uae30 \uc704\ud574, \uc774\ub97c Excel \uc6cc\ud06c\ud50c\ub85c\uc5d0 \ub9e4\ud551\ud560 \uc218 \uc788\uc73c\uba70, \uc774\ub294 \ud68c\uacc4 \uc2dc\uc2a4\ud15c\uc5d0 \ub4e4\uc5b4\uac00\uae30 \uc804\uc5d0 \uc0ac\ub78c\uc774 \uac80\ud1a0\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4."
      },
      "typeVersion": 1
    },
    {
      "id": "68f7c7f3-5ddd-4291-adb3-78f3a297fd8e",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2120,
        -660
      ],
      "parameters": {
        "width": 480,
        "height": 960,
        "content": "## \uc2dc\ub3c4\ud574 \ubcf4\uc138\uc694  \n### \uc774 n8n \ud15c\ud50c\ub9bf\uc740 Outlook \uc0ac\uc11c\ud568\uc758 \uc1a1\uc7a5\ub4e4\uc744 \ubaa8\ub2c8\ud130\ub9c1\ud558\uc5ec \uc790\ub3d9\uc73c\ub85c \ub370\uc774\ud130\ub97c \ud30c\uc2f1/\ucd94\ucd9c\ud55c \ud6c4 \uacb0\uacfc\ub97c Excel \ud1b5\ud569\ubb38\uc11c\uc5d0 \uc5c5\ub85c\ub4dc\ud569\ub2c8\ub2e4.  \n\n\uac00\uc7a5 \ub9ce\uc774 \uc694\uccad\ubc1b\ub294 \uc6cc\ud06c\ud50c\ub85c \uc911 \ud558\ub098\uc778 \uc774 \ud15c\ud50c\ub9bf\uc740 \uadc0\ud558\ub098 \uadc0\ud558\uc758 \uc7ac\ubb34 \ud300\uc774 \uc218\ubc31 \uc2dc\uac04\uc758 \uc218\ub3d9 \uc791\uc5c5\uc744 \uc808\uc57d\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.  \n\n### \uc791\ub3d9 \uc6d0\ub9ac  \n* \uc2a4\ucf00\uc904\ub41c \ud2b8\ub9ac\uac70\uac00 Accounts receivable \uc0ac\uc11c\ud568\uc758 \ucd5c\uadfc Outlook \uba54\uc2dc\uc9c0\ub97c \uac00\uc838\uc624\ub3c4\ub85d \uc124\uc815\ub429\ub2c8\ub2e4.  \n* \uac01 \uba54\uc2dc\uc9c0\uac00 \uacf5\uae09\uc790\ub85c\ubd80\ud130 \uc628 \uac83\uc778\uc9c0, \uc1a1\uc7a5\uc744 \ubc1c\ud589\ud558\uac70\ub098 \ud3ec\ud568\ud558\uace0 \uc788\ub294\uc9c0 \ubd84\uc11d\ud569\ub2c8\ub2e4.  \n* \uc720\ud6a8\ud55c \uac01 \uba54\uc2dc\uc9c0\uc5d0 \ub300\ud574 \ucca8\ubd80 \ud30c\uc77c\uc744 \ub2e4\uc6b4\ub85c\ub4dc\ud558\uace0, AI \ube44\uc804 \ubd84\ub958\ub97c \ud1b5\ud574 \uc1a1\uc7a5\uc774 \uc544\ub2cc \ubb38\uc11c\ub97c \ud544\ud130\ub9c1\ud569\ub2c8\ub2e4.  \n* \uc1a1\uc7a5\uc740 AI \ube44\uc804 \ubaa8\ub378\uc744 \ud1b5\ud574 \ub2e4\uc2dc \ucc98\ub9ac\ud558\uc5ec \uc138\ubd80 \uc815\ubcf4\ub97c \ucd94\ucd9c\ud569\ub2c8\ub2e4.  \n* \ucd94\ucd9c\ub41c \ub370\uc774\ud130\ub294 \uc870\uc815\uc774\ub098 \uae30\ud0c0 \uc6a9\ub3c4\ub85c \uc0ac\uc6a9\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \uc774 \ub370\ubaa8\uc5d0\uc11c\ub294 \uac04\ub2e8\ud788 Excel \uc2dc\ud2b8\uc5d0 \ud589\uc744 \ucd94\uac00\ud569\ub2c8\ub2e4.  \n\n### \uc0ac\uc6a9 \ubc29\ubc95  \n* Microsoft365 \uc790\uaca9\uc99d\uba85\uc774 \uc62c\ubc14\ub978 \uc0ac\uc11c\ud568\uc744 \uac00\ub9ac\ud0a4\ub3c4\ub85d \ud655\uc778\ud558\uc138\uc694. \uacf5\uc720 \ud3f4\ub354\ub97c \uc0ac\uc6a9\ud558\ub294 \uacbd\uc6b0, \"\uacf5\uc720 \ud3f4\ub354\" \uc635\uc158\uc744 \"\ucf1c\uae30\"\ub85c \uc804\ud658\ud558\uace0 \uc8fc\uc694 ID\uc5d0 \uc774\uba54\uc77c \uc8fc\uc18c\ub97c \uc0ac\uc6a9\ud558\uc138\uc694.  \n* \ub2e4\ub978 \uc720\ud615\uc758 \uba54\uc2dc\uc9c0(\uc608: \ub2f5\uc7a5 \ubc0f \uc804\ub2ec \uba54\uc2dc\uc9c0)\ub97c \ub9ce\uc774 \ubc1b\ub294 \uacbd\uc6b0, \uc1a1\uc7a5\uc744 \ub450 \ubc88 \ucc98\ub9ac\ud558\uc9c0 \uc54a\ub3c4\ub85d \ucd94\uac00 \uac80\uc0ac\ub97c \uad6c\ud604\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \"\uc911\ubcf5 \uc81c\uac70\" \ub178\ub4dc\uac00 \uc774\uc5d0 \ub3c4\uc6c0\uc774 \ub429\ub2c8\ub2e4.  \n\n### \ub3c4\uc6c0\uc774 \ud544\uc694\ud558\uc138\uc694?  \n[Discord](https://discord.com/invite/XPKeKXeB7d) \uc5d0 \uac00\uc785\ud558\uac70\ub098 [Forum](https://community.n8n.io/) \uc5d0 \ubb38\uc758\ud558\uc138\uc694!  \n\n\uc990\uac70\uc6b4 \ud574\ud0b9!"
      },
      "typeVersion": 1
    },
    {
      "id": "a55323b4-2079-4a7c-8ba2-f20ef0930b55",
      "name": "Invoice Classifier With Gemini 2.0",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -260,
        340
      ],
      "parameters": {
        "url": "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent",
        "method": "POST",
        "options": {},
        "jsonBody": "={{\n{\n  \"contents\": [\n    {\n      \"parts\": [\n        {\n          \"inline_data\": {\n            \"mime_type\": $('Split Attachments').item.binary.data.mimeType,\n            \"data\": $json.data\n          }\n        },\n        {\n          \"text\": `You are an accounts receivable agent who is helping to identify if the document is an invoice, the invoice's supplier is not our company and the invoice is issued to our company.`\n        }\n      ]\n    }\n  ],\n  \"generationConfig\": {\n    \"response_mime_type\": \"application/json\",\n    \"response_schema\": {\n      \"type\": \"OBJECT\",\n      \"required\": [\n        \"is_invoice\",\n        \"is_issued_to_company\"\n      ],\n      \"properties\": {\n        \"is_invoice\": { \"type\": \"boolean\" },\n        \"is_issued_to_company\": { \"type\": \"boolean\" }\n      }\n    }\n  }\n}\n}}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "googlePalmApi"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "executeOnce": false,
      "retryOnFail": false,
      "typeVersion": 4.2
    },
    {
      "id": "f696737d-cddf-411b-a427-cc72bd68d248",
      "name": "File-Based OCR with Gemini 2.0",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueErrorOutput",
      "position": [
        480,
        400
      ],
      "parameters": {
        "url": "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent",
        "method": "POST",
        "options": {},
        "jsonBody": "={{\n{\n  \"contents\": [\n    {\n      \"parts\": [\n        {\n          \"inline_data\": {\n            \"mime_type\": $('Split Attachments').item.binary.data.mimeType,\n            \"data\": $('Extract from File').item.json.data\n          }\n        },\n        {\n          \"text\": `You are an accounts receivable agent who is helping to extract information from a supplier's invoice issued to our company.`\n        }\n      ]\n    }\n  ],\n  \"generationConfig\": {\n    \"response_mime_type\": \"application/json\",\n    \"response_schema\": {\n      \"type\": \"OBJECT\",\n      \"required\": [\n        \"invoice_number\",\n        \"invoice_date\",\n        \"invoice_amount\",\n        \"invoice_due_date\",\n        \"supplier_name\",\n        \"supplier_address\",\n        \"supplier_telephone\",\n        \"supplier_email\",\n        \"booking_number\",\n        \"booking_date\",\n        \"booking_name\",\n        \"guest_name\",\n        \"guest_quantity\",\n        \"services\"\n      ],\n      \"properties\": {\n        \"invoice_number\": { \"type\": \"string\" },\n        \"invoice_date\": { \"type\": \"string\", \"nullable\": true },\n        \"invoice_amount\": { \"type\": \"number\", \"nullable\": true },\n        \"invoice_due_date\": { \"type\": \"string\", \"nullable\": true },\n        \"recipient_name\": { \"type\": \"string\", \"nullable\": true },\n        \"recipient_address\": { \"type\": \"string\", \"nullable\": true },\n        \"recipient_company_number\": { \"type\": \"string\", \"nullable\": true },\n        \"supplier_name\": { \"type\": \"string\", \"nullable\": true },\n        \"supplier_address\": { \"type\": \"string\", \"nullable\": true },\n        \"supplier_telephone\": { \"type\": \"string\", \"nullable\": true },\n        \"supplier_email\": { \"type\": \"string\", \"nullable\": true },\n        \"supplier_company_number\": { \"type\": \"string\", \"nullable\": true },\n        \"booking_number\": { \"type\": \"string\", \"nullable\": true },\n        \"booking_date\": { \"type\": \"string\", \"nullable\": true },\n        \"booking_name\": { \"type\": \"string\", \"nullable\": true },\n        \"guest_name\": { \"type\": \"string\", \"nullable\": true },\n        \"guest_quantity\": { \"type\": \"number\", \"nullable\": true },\n        \"services\": {\n          \"type\": \"array\",\n          \"items\": {\n            \"type\": \"object\",\n            \"required\": [],\n            \"properties\": {\n              \"name\": { \"type\": \"string\" },\n              \"date\": { \"type\": \"string\", \"nullable\": true },\n              \"description\": { \"type\": \"string\", \"nullable\": true },\n              \"quantity\": { \"type\": \"number\", \"nullable\": true },\n              \"total\": { \"type\": \"number\" }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n}}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "googlePalmApi"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "executeOnce": false,
      "retryOnFail": false,
      "typeVersion": 4.2
    },
    {
      "id": "1d76c0c8-a03b-4f0c-b76d-53369ab5d6e8",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        760,
        -220
      ],
      "parameters": {
        "color": 5,
        "width": 400,
        "height": 140,
        "content": "### \uc5b4\ub514\ub85c \uac08\uae4c\uc694? \ub2f9\uc2e0\uc5d0\uac8c \ub9e1\uaca8\uc694!  \n\uc774 \ud15c\ud50c\ub9bf\uc740 \ube4c\ub4dc\ub97c \uc2dc\uc5f0\ud558\uae30 \uc704\ud574 \uc758\ub3c4\uc801\uc73c\ub85c \ucd95\uc18c\ub418\uc5c8\uc9c0\ub9cc, \ud68c\uacc4 \uc2dc\uc2a4\ud15c\uc5d0 \uc9c1\uc811 \uc5c5\ub85c\ub4dc\ud558\uac70\ub098 \uc1a1\uc7a5 \uc870\uc815\uacfc \uac19\uc740 \ub2e4\ub978 \uc791\uc5c5\uc744 \uc704\ud574 \uc27d\uac8c \uc218\uc815\ud558\uac70\ub098 \ud655\uc7a5\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4."
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Wait": {
      "main": [
        [
          {
            "node": "For Each Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Model": {
      "ai_languageModel": [
        [
          {
            "node": "Message Classifier",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Markdown": {
      "main": [
        [
          {
            "node": "Message Classifier",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Message Ref": {
      "main": [
        [
          {
            "node": "Download Attachments",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Has Invoice?": {
      "main": [
        [
          {
            "node": "File-Based OCR with Gemini 2.0",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Empty Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Output": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Empty Response": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Invoices": {
      "main": [
        [
          {
            "node": "Has Invoice?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "For Each Message": {
      "main": [
        [
          {
            "node": "Microsoft Excel 365",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Message Ref",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Get Recent Messages",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract from File": {
      "main": [
        [
          {
            "node": "Invoice Classifier With Gemini 2.0",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Attachments": {
      "main": [
        [
          {
            "node": "Extract from File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Message Classifier": {
      "main": [
        [
          {
            "node": "For Each Message",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Get Recent Messages": {
      "main": [
        [
          {
            "node": "Markdown",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Attachments": {
      "main": [
        [
          {
            "node": "Split Attachments",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "File-Based OCR with Gemini 2.0": {
      "main": [
        [
          {
            "node": "Parse Output",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Empty Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Invoice Classifier With Gemini 2.0": {
      "main": [
        [
          {
            "node": "Filter Invoices",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    }
  }
}