{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "32dec238-615e-461d-ac9b-e09bdcb2a73f",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        560,
        200
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "4cb973bc-385f-42db-b79e-942c75d97a84",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        780,
        200
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"invoice_number\": \"\",\n  \"invoice_date\": \"\",\n  \"due_date\": \"\",\n  \"vendor_name\": \"\",\n  \"total_amount\": \"\",\n  \"currency\": \"\",\n  \"items\": [\n    {\n      \"description\": \"\",\n      \"amount\": \"\"\n    }\n  ],\n  \"tax\": \"\",\n  \"category\": \"\"\n}"
      },
      "typeVersion": 1.2
    },
    {
      "id": "b7ed6cf6-e965-43e0-abab-919ab598e62a",
      "name": "Invoice Folder Monitor",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "position": [
        -100,
        -220
      ],
      "parameters": {
        "event": "fileCreated",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "triggerOn": "specificFolder",
        "folderToWatch": {
          "__rl": true,
          "mode": "id",
          "value": "1KJ4fvXcKVMGJunsKvPYf8PkX5K9SVwFk"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "d2a0d543-1ee3-4852-9751-69aae3b9864a",
      "name": "Download Invoice PDF",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        100,
        -220
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        },
        "options": {},
        "operation": "download"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "80345f83-02fa-47ab-86f0-1e01bd3429e7",
      "name": "Invoice Parser AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        580,
        0
      ],
      "parameters": {
        "text": "=You are an intelligent invoice parser. I will give you raw text extracted from a PDF invoice. \n\n========================\nSTART OF RAW INVOICE TEXT\n\n{{ $json.text }}\n\nEND OF RAW INVOICE TEXT\n========================\n\nYour job is to:\n\n1. Extract key information from the invoice such as:\n   - invoice_number\n   - invoice_date\n   - due_date (if available)\n   - vendor_name\n   - total_amount\n   - currency (e.g., USD, IDR, etc.)\n   - items (as a list of item descriptions and their amounts)\n   - tax (if available)\n\n2. Detect the invoice **category**, such as:\n   - Utilities\n   - Office Supplies\n   - Travel\n   - Software\n   - Food & Beverage\n   - Others (if unknown)\n\n3. Return the result in this exact JSON format:\n\n```json\n{\n  \"invoice_number\": \"\",\n  \"invoice_date\": \"\",\n  \"due_date\": \"\",\n  \"vendor_name\": \"\",\n  \"total_amount\": \"\",\n  \"currency\": \"\",\n  \"items\": [\n    {\n      \"description\": \"\",\n      \"amount\": \"\"\n    }\n  ],\n  \"tax\": \"\",\n  \"category\": \"\"\n}\n",
        "options": {},
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.9
    },
    {
      "id": "57649f6a-2d4d-4072-92bd-ffea26fdd4dd",
      "name": "Insert Invoice Data",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1460,
        0
      ],
      "parameters": {
        "columns": {
          "value": {
            "Tax": "={{ $('Invoice Parser AI Agent').item.json.output.tax }}",
            "Items": "={{ $('Invoice Parser AI Agent').item.json.output.items }}",
            "Approved": "={{ $json.data['Approve Invoice?'] }}",
            "Category": "={{ $('Invoice Parser AI Agent').item.json.output.category }}",
            "Currency": "={{ $('Invoice Parser AI Agent').item.json.output.currency }}",
            "Due Date": "={{ $('Invoice Parser AI Agent').item.json.output.due_date }}",
            "Reviewed By": "={{ $json.data['Reviewed By'] }}",
            "Vendor Name": "={{ $('Invoice Parser AI Agent').item.json.output.vendor_name }}",
            "Invoice Date": "={{ $('Invoice Parser AI Agent').item.json.output.invoice_date }}",
            "Total Amount": "={{ $('Invoice Parser AI Agent').item.json.output.total_amount }}",
            "Approval Notes": "={{ $json.data['Approval Notes'] }}",
            "Invoice Number": "={{ $('Invoice Parser AI Agent').item.json.output.invoice_number }}"
          },
          "schema": [
            {
              "id": "Invoice Number",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Invoice Number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Invoice Date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Invoice Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Due Date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Due Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Vendor Name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Vendor Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Total Amount",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Total Amount",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Currency",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Currency",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Items",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Items",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Tax",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Tax",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Category",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Category",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Approved",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Approved",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Approval Notes",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Approval Notes",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Reviewed By",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Reviewed By",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ueJfN5dFTXY3_AdvnYUL5_RjV9YwSFvbxwA_ivtqnJk/edit#gid=0",
          "cachedResultName": "Invoices"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1ueJfN5dFTXY3_AdvnYUL5_RjV9YwSFvbxwA_ivtqnJk",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ueJfN5dFTXY3_AdvnYUL5_RjV9YwSFvbxwA_ivtqnJk/edit?usp=drivesdk",
          "cachedResultName": "Copy of PDF Invoice Parser - n8n template"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "2993f865-d46c-489b-ab34-3c62b2c3cb1f",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -460,
        -220
      ],
      "parameters": {
        "color": 4,
        "width": 280,
        "height": 500,
        "content": "## \uc124\uc815 \ud544\uc694\n\nGoogle Sheets \uad6c\uc870:  \n\uc2dc\ud2b8: \"Invoices\"  \n\u2022 \uc5f4 A: \uc1a1\uc7a5 \ubc88\ud638  \n\u2022 \uc5f4 B: \uc1a1\uc7a5 \ub0a0\uc9dc  \n\u2022 \uc5f4 C: \ub9c8\uac10 \ub0a0\uc9dc  \n\u2022 \uc5f4 D: \uacf5\uae09\uc5c5\uccb4 \uc774\ub984  \n\u2022 \uc5f4 E: \ucd1d \uae08\uc561  \n\u2022 \uc5f4 F: \ud1b5\ud654  \n\u2022 \uc5f4 G: \ud56d\ubaa9  \n\u2022 \uc5f4 H: \uc138\uae08  \n\u2022 \uc5f4 I: \uce74\ud14c\uace0\ub9ac  \n\u2022 \uc5f4 J: \uc2b9\uc778\ub428  \n\u2022 \uc5f4 K: \uc2b9\uc778 \ub178\ud2b8  \n\u2022 \uc5f4 L: \uac80\ud1a0\uc790  \n\n\ud544\uc694\ud55c \uc790\uaca9\uc99d\uba85:  \n\u2022 Google Drive \uc790\uaca9\uc99d\uba85  \n\u2022 Gmail \uc790\uaca9\uc99d\uba85  \n\u2022 Google Sheets \uc790\uaca9\uc99d\uba85  \n\u2022 OpenAI API \ud0a4 (GPT-4)"
      },
      "typeVersion": 1
    },
    {
      "id": "691f4972-8d18-49fd-b8cd-0c6b2464b078",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -120,
        420
      ],
      "parameters": {
        "color": 5,
        "width": 700,
        "height": 560,
        "content": "## \ud83e\uddfe OpenAI\uc640 Google Sheets\ub97c \uc0ac\uc6a9\ud55c \uc790\ub3d9\ud654\ub41c PDF \uc778\ubcf4\uc774\uc2a4 \ucc98\ub9ac \ubc0f \uc2b9\uc778 \ud750\ub984\n\nWhat This Template Does:\n\n- **Google Drive**, **Gmail**, \ubc0f **\uc6f9 \ud3fc**\uc5d0\uc11c \ub4e4\uc5b4\uc624\ub294 PDF \uc778\ubcf4\uc774\uc2a4\ub97c \ubaa8\ub2c8\ud130\ub9c1  \n- PDF \ucca8\ubd80 \ud30c\uc77c\uc744 \uc790\ub3d9\uc73c\ub85c \ub2e4\uc6b4\ub85c\ub4dc\ud558\uace0 \uc6d0\uc2dc \ud14d\uc2a4\ud2b8\ub97c \ucd94\ucd9c  \n- **GPT-4o-mini**\ub97c \uc0ac\uc6a9\ud558\uc5ec \uc778\ubcf4\uc774\uc2a4 \ub370\uc774\ud130(\uc778\ubcf4\uc774\uc2a4 \ubc88\ud638, \uacf5\uae09\uc790, \ub0a0\uc9dc, \uae08\uc561, \uc138\uae08, \ud56d\ubaa9 \ub4f1)\ub97c \uc9c0\ub2a5\uc801\uc73c\ub85c \uad6c\ubb38 \ubd84\uc11d  \n- \uc778\ubcf4\uc774\uc2a4\ub97c *Utilities, Travel, Office Supplies, Food & Beverage, Others*\uc640 \uac19\uc740 \uc720\ud615\uc73c\ub85c \ubd84\ub958  \n- \ub0b4\uc7a5\ub41c \uacb0\uc815 \uc591\uc2dd(Yes/No, \ub9ac\ubdf0\uc5b4 \uc774\ub984, \ub178\ud2b8)\uc774 \ud3ec\ud568\ub41c \ub3d9\uc801 **\uc2b9\uc778 \uc694\uccad \uc774\uba54\uc77c**\uc744 \ubcf4\ub0c4  \n- \uc2b9\uc778\ub41c \ubc0f \uac70\ubd80\ub41c \uc778\ubcf4\uc774\uc2a4 \ub370\uc774\ud130\ub97c **Google Sheets**\uc5d0 \uc800\uc7a5\ud558\uc5ec \uae30\ub85d \uc720\uc9c0  \n- \uac70\ubd80 \uc54c\ub9bc\uc744 \uc7ac\ubb34 \ud300\uc5d0 \ubcf4\ub0b4 \ud6c4\uc18d \uc870\uce58\ub97c \ucde8\ud568  \n- \uc778\uac04 \uac10\ub3c5\uc774 \ud3ec\ud568\ub41c \uc644\uc804\ud55c \uc790\ub3d9\ud654\ub41c \uc2b9\uc778 \ud30c\uc774\ud504\ub77c\uc778\uc744 \uc81c\uacf5  \n- \uc77c\uad00\ub418\uace0 \uc624\ub958 \uc5c6\ub294 AI \ucd9c\ub825\uc744 \uc704\ud55c \uad6c\uc870\ud654\ub41c JSON \uc2a4\ud0a4\ub9c8\ub97c \ud3ec\ud568  \n- \uc785\ub825 \uc18c\uc2a4\ub97c \ub9e4\ubd84\ub9c8\ub2e4 \ud3f4\ub9c1\ud558\uc5ec \uc2e0\uc18d\ud558\uace0 \uc751\ub2f5\uc131 \uc788\ub294 \ucc98\ub9ac\ub97c \ubcf4\uc7a5  \n- AI\ub97c \ud1b5\ud574 \uc778\ubcf4\uc774\uc2a4 \uc2b9\uc778 \ubc0f \ubd80\uae30 \uc6cc\ud06c\ud50c\ub85c\ub97c **\uc790\ub3d9\ud654**\ud558\ub824\ub294 \ube44\uc988\ub2c8\uc2a4\uc5d0 \uc774\uc0c1\uc801"
      },
      "typeVersion": 1
    },
    {
      "id": "2463666d-8c40-4821-b907-9741e62ce1e7",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        620,
        420
      ],
      "parameters": {
        "color": 5,
        "width": 620,
        "height": 620,
        "content": "## \ud83d\udccb \uc6cc\ud06c\ud50c\ub85c \ud504\ub85c\uc138\uc2a4 \uac1c\uc694\n\n1. **\uc778\ubcf4\uc774\uc2a4 \uc218\uc9d1**  \n\uc778\ubcf4\uc774\uc2a4\uac00 \uc138 \uac00\uc9c0 \ud2b8\ub9ac\uac70\ub97c \ud1b5\ud574 \ucea1\ucc98\ub429\ub2c8\ub2e4: Google Drive \ud3f4\ub354\uc758 \uc0c8\ub85c\uc6b4 PDF, PDF \ucca8\ubd80 \ud30c\uc77c\uc774 \uc788\ub294 \ub4e4\uc5b4\uc624\ub294 Gmail \uba54\uc2dc\uc9c0, \ub610\ub294 \uc6f9 \uc591\uc2dd\uc744 \ud1b5\ud55c \uc9c1\uc811 \uc5c5\ub85c\ub4dc.\n\n2. **\ud30c\uc77c \ucc98\ub9ac**  \nDrive\ub97c \ud1b5\ud574 \uc5c5\ub85c\ub4dc\ub41c \uacbd\uc6b0, PDF\ub294 \ud30c\uc77c ID\ub97c \uc0ac\uc6a9\ud558\uc5ec \ub2e4\uc6b4\ub85c\ub4dc\ub429\ub2c8\ub2e4; Gmail\uc774\ub098 \uc591\uc2dd\uc744 \ud1b5\ud574 \uc5c5\ub85c\ub4dc\ub41c \uacbd\uc6b0, PDF\ub294 \uc774\ubbf8 \uc774\uc9c4 \ub370\uc774\ud130\ub85c \uc0ac\uc6a9\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.\n\n3. **\ud14d\uc2a4\ud2b8 \ucd94\ucd9c**  \n\uc2dc\uc2a4\ud15c\uc740 \uc18c\uc2a4(Drive, \uc774\uba54\uc77c, \ub610\ub294 \uc591\uc2dd)\uc5d0 \ub530\ub77c \uc801\uc808\ud55c \ubc29\ubc95\uc744 \uc0ac\uc6a9\ud558\uc5ec PDF\uc5d0\uc11c \uc6d0\uc2dc \ud14d\uc2a4\ud2b8\ub97c \ucd94\ucd9c\ud569\ub2c8\ub2e4.\n\n4. **AI \ub370\uc774\ud130 \ud30c\uc2f1**  \nGPT-4\uac00 \ucd94\ucd9c\ub41c \ud14d\uc2a4\ud2b8\ub97c \uad6c\uc870\ud654\ub41c JSON\uc73c\ub85c \ucc98\ub9ac\ud558\uc5ec \uc778\ubcf4\uc774\uc2a4 \uc138\ubd80 \uc815\ubcf4(\uacf5\uae09\uc5c5\uccb4, \ub0a0\uc9dc, \uae08\uc561 \ub4f1)\ub97c \uc2dd\ubcc4\ud558\uace0 \uc778\ubcf4\uc774\uc2a4\ub97c \ubd84\ub958\ud569\ub2c8\ub2e4.\n\n5. **\uc2b9\uc778 \uc694\uccad**  \n\uac80\ud1a0\uc790\uc5d0\uac8c \uc2b9\uc778 \uc591\uc2dd\uc774 \ud3ec\ud568\ub41c \uc774\uba54\uc77c\uc744 \ubcf4\ub0b4 Yes/No \uacb0\uc815\uc744 \uc694\uccad\ud558\uba70, \uc120\ud0dd\uc801\uc73c\ub85c \ub178\ud2b8\ub97c \ucd94\uac00\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.\n\n6. **\uacb0\uc815 \ub77c\uc6b0\ud305**  \n\uc2b9\uc778\ub41c \uacbd\uc6b0, \ub370\uc774\ud130\uac00 \uc800\uc7a5\uc744 \uc704\ud574 \uc9c4\ud589\ub429\ub2c8\ub2e4; \uac70\ubd80\ub41c \uacbd\uc6b0, \uc7ac\ubb34 \ud300\uc5d0 \ud1b5\uc9c0\uac00 \ubcf4\ub0b4\uc9d1\ub2c8\ub2e4.\n\n7. **\uc778\ubcf4\uc774\uc2a4 \ub370\uc774\ud130 \uc800\uc7a5**  \n\ucd94\ucd9c\ub418\uace0 \uac80\ud1a0\ub41c \ubaa8\ub4e0 \uc778\ubcf4\uc774\uc2a4 \ub370\uc774\ud130\uac00 Google Sheet\uc5d0 \uc800\uc7a5\ub418\uc5b4 \uac01 \uc778\ubcf4\uc774\uc2a4\uc640 \uadf8 \uc0c1\ud0dc\uc5d0 \ub300\ud55c \uc804\uccb4 \uae30\ub85d\uc744 \uc720\uc9c0\ud569\ub2c8\ub2e4."
      },
      "typeVersion": 1
    },
    {
      "id": "8483b8ef-83d7-4b3f-ad54-b9ec23efc911",
      "name": "Send Invoice for Approval",
      "type": "n8n-nodes-base.gmail",
      "position": [
        920,
        0
      ],
      "parameters": {
        "sendTo": "replace_with_approver_email@yopmail.com",
        "message": "=A new invoice has been submitted and requires your review and approval:",
        "options": {},
        "subject": "=[Action Required] Invoice Approval Request \u2013 {{ $json.output.vendor_name }}",
        "operation": "sendAndWait",
        "formFields": {
          "values": [
            {
              "fieldType": "dropdown",
              "fieldLabel": "Approve Invoice?",
              "fieldOptions": {
                "values": [
                  {
                    "option": "Yes"
                  },
                  {
                    "option": "No"
                  }
                ]
              },
              "requiredField": true
            },
            {
              "fieldLabel": "Reviewed By",
              "requiredField": true
            },
            {
              "fieldType": "textarea",
              "fieldLabel": "Approval Notes"
            }
          ]
        },
        "responseType": "customForm"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "0fece28b-13c8-4b0d-9c1b-84047a3503f6",
      "name": "Monitor Email Attachments",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        100,
        0
      ],
      "parameters": {
        "simple": false,
        "filters": {},
        "options": {
          "downloadAttachments": true,
          "dataPropertyAttachmentsPrefixName": "attachment_"
        },
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "d210d1c5-865f-494e-a69c-d25ac462869b",
      "name": "Upload Invoice (PDF) Form",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        100,
        200
      ],
      "parameters": {
        "options": {},
        "formTitle": "Upload Invoice (PDF)",
        "formFields": {
          "values": [
            {
              "fieldType": "file",
              "fieldLabel": "Upload",
              "multipleFiles": false,
              "requiredField": true,
              "acceptFileTypes": ".pdf"
            }
          ]
        },
        "formDescription": "Upload your invoice PDF using this form."
      },
      "typeVersion": 2.2
    },
    {
      "id": "4703ddb5-1e07-43b9-a465-c9aced0ac9d8",
      "name": "Extract Text from Drive PDF",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        300,
        -220
      ],
      "parameters": {
        "options": {},
        "operation": "pdf"
      },
      "typeVersion": 1
    },
    {
      "id": "7ca78f71-8c1e-42e2-8686-08f2a9bfc009",
      "name": "Extract Text from Email PDF",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        300,
        0
      ],
      "parameters": {
        "options": {},
        "operation": "pdf",
        "binaryPropertyName": "attachment_0"
      },
      "typeVersion": 1
    },
    {
      "id": "0b4aff7d-8c92-4964-a38c-996b546ed23a",
      "name": "Extract Text from Form PDF",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        300,
        200
      ],
      "parameters": {
        "options": {},
        "operation": "pdf",
        "binaryPropertyName": "Upload"
      },
      "typeVersion": 1
    },
    {
      "id": "eef8e5e5-2b01-4ddd-8ea2-312fb41356de",
      "name": "Check Approval Decision",
      "type": "n8n-nodes-base.if",
      "position": [
        1180,
        0
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "451bfdfc-f645-4e3c-91cc-895558f45b11",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.data['Approve Invoice?'] }}",
              "rightValue": "Yes"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "ac5dd79d-9d32-44f9-8a9b-2cc45757110b",
      "name": "Send Rejection Alert",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1320,
        260
      ],
      "parameters": {
        "sendTo": "finance_team@yopmail.com",
        "message": "=Hi Finance Team,\n\nAn invoice from {{ $('Invoice Parser AI Agent').item.json.output.vendor_name }} has been disapproved during the approval process.\n\nReviewed By: {{ $('Send Invoice for Approval').item.json.data['Reviewed By'] }}\nApproval Notes: {{ $('Send Invoice for Approval').item.json.data['Approval Notes'] }}\n\nPlease review and follow up as needed.\n\nThank you,\nAutomated Invoice System\n\n",
        "options": {
          "appendAttribution": false
        },
        "subject": "=[Alert] Invoice Disapproved \u2013 {{ $('Invoice Parser AI Agent').item.json.output.vendor_name }}",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    }
  ],
  "connections": {
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Invoice Parser AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Download Invoice PDF": {
      "main": [
        [
          {
            "node": "Extract Text from Drive PDF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Rejection Alert": {
      "main": [
        [
          {
            "node": "Insert Invoice Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Invoice Folder Monitor": {
      "main": [
        [
          {
            "node": "Download Invoice PDF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Approval Decision": {
      "main": [
        [
          {
            "node": "Insert Invoice Data",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Rejection Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Invoice Parser AI Agent": {
      "main": [
        [
          {
            "node": "Send Invoice for Approval",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Invoice Parser AI Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Monitor Email Attachments": {
      "main": [
        [
          {
            "node": "Extract Text from Email PDF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Invoice for Approval": {
      "main": [
        [
          {
            "node": "Check Approval Decision",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload Invoice (PDF) Form": {
      "main": [
        [
          {
            "node": "Extract Text from Form PDF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Text from Form PDF": {
      "main": [
        [
          {
            "node": "Invoice Parser AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Text from Drive PDF": {
      "main": [
        [
          {
            "node": "Invoice Parser AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Text from Email PDF": {
      "main": [
        [
          {
            "node": "Invoice Parser AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}