This workflow follows the Agent → Gmail Trigger recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"name": "Portfolio 1: Invoice manager",
"nodes": [
{
"parameters": {
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
},
"simple": false,
"filters": {},
"options": {
"downloadAttachments": true
}
},
"type": "n8n-nodes-base.gmailTrigger",
"typeVersion": 1.3,
"position": [
-608,
-304
],
"id": "41a27b07-fd80-464f-b434-884e35620569",
"name": "Incoming Invoice",
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"inputDataFieldName": "attachment_0",
"name": "Invoice 1",
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive"
},
"folderId": {
"__rl": true,
"value": "1fPc2_xH0sx0aozkaJm07lAuZ0vIrxlgR",
"mode": "list",
"cachedResultName": "Invoices for portfolio",
"cachedResultUrl": "https://drive.google.com/drive/folders/1fPc2_xH0sx0aozkaJm07lAuZ0vIrxlgR"
},
"options": {}
},
"type": "n8n-nodes-base.googleDrive",
"typeVersion": 3,
"position": [
-384,
-304
],
"id": "2bfdb663-bf4c-4185-ae6f-e62fc40e1db6",
"name": "Saving original file",
"credentials": {
"googleDriveOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"operation": "text",
"options": {}
},
"type": "n8n-nodes-base.extractFromFile",
"typeVersion": 1.1,
"position": [
512,
-112
],
"id": "fdffa5cd-075c-49b2-8ccb-bc35e4a32bef",
"name": "Extract from File"
},
{
"parameters": {
"operation": "download",
"fileId": {
"__rl": true,
"value": "1y6h1mj862DfE0LHNjlW9zjWuoQVz6kFf",
"mode": "list",
"cachedResultName": "Invoice 1",
"cachedResultUrl": "https://drive.google.com/file/d/1y6h1mj862DfE0LHNjlW9zjWuoQVz6kFf/view?usp=drivesdk"
},
"options": {}
},
"type": "n8n-nodes-base.googleDrive",
"typeVersion": 3,
"position": [
288,
-112
],
"id": "1dfe81e5-d6ad-4c4c-80f5-4c4614f14f98",
"name": "Download file",
"credentials": {
"googleDriveOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"promptType": "define",
"text": "=Incoming file data: {{ $json.data }}",
"hasOutputParser": true,
"options": {
"systemMessage": "=Extract invoice data and return ONLY valid JSON.\n\nRules:\n- Output must match schema exactly\n- Do NOT include explanations\n- Do NOT include markdown or text\n- Use null if value is missing\n- All numbers must be numeric (no currency symbols)\n- Do NOT omit any fields"
}
},
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 3,
"position": [
736,
-112
],
"id": "01689aaa-42a6-4538-9f87-f8c161e77c0b",
"name": "AI Agent"
},
{
"parameters": {
"model": {
"__rl": true,
"value": "gpt-4o-mini",
"mode": "list",
"cachedResultName": "gpt-4o-mini"
},
"builtInTools": {},
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"typeVersion": 1.3,
"position": [
752,
112
],
"id": "fd565b5a-462d-4f28-bb7c-c55ee3d30123",
"name": "OpenAI Chat Model",
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"schemaType": "manual",
"inputSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"vendor\": {\n \"type\": \"object\",\n \"properties\": {\n \"name\": { \"type\": \"string\" },\n \"address\": { \"type\": \"string\" },\n \"email\": { \"type\": \"string\" }\n }\n },\n \"invoice\": {\n \"type\": \"object\",\n \"properties\": {\n \"invoice_number\": { \"type\": \"string\" },\n \"invoice_date\": { \"type\": \"string\" },\n \"due_date\": { \"type\": \"string\" }\n }\n },\n \"payment\": {\n \"type\": \"object\",\n \"properties\": {\n \"currency\": { \"type\": \"string\" },\n \"subtotal\": { \"type\": \"number\" },\n \"tax\": { \"type\": \"number\" },\n \"total_amount\": { \"type\": \"number\" }\n }\n },\n \"line_items\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"description\": { \"type\": \"string\" },\n \"quantity\": { \"type\": \"number\" },\n \"unit_price\": { \"type\": \"number\" },\n \"total\": { \"type\": \"number\" }\n }\n }\n }\n }\n}"
},
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"typeVersion": 1.3,
"position": [
880,
112
],
"id": "d17229c2-322b-45cd-8932-94751d91238e",
"name": "Structured Output Parser"
},
{
"parameters": {},
"type": "n8n-nodes-base.noOp",
"typeVersion": 1,
"position": [
2336,
-304
],
"id": "da1a9dee-c341-4ffe-a85a-375f1896c62a",
"name": "No Operation, do nothing"
},
{
"parameters": {
"schemaType": "manual",
"inputSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"vendor\": {\n \"type\": \"object\",\n \"properties\": {\n \"name\": { \"type\": \"string\" }\n }\n },\n \"invoice\": {\n \"type\": \"object\",\n \"properties\": {\n \"invoice_number\": { \"type\": \"string\" },\n \"invoice_date\": { \"type\": \"string\" },\n \"due_date\": { \"type\": \"string\" }\n }\n },\n \"payment\": {\n \"type\": \"object\",\n \"properties\": {\n \"currency\": { \"type\": \"string\" },\n \"subtotal\": { \"type\": \"number\" },\n \"tax\": { \"type\": \"number\" },\n \"total_amount\": { \"type\": \"number\" }\n }\n },\n \"line_items\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"description\": { \"type\": \"string\" },\n \"quantity\": { \"type\": \"number\" },\n \"unit_price\": { \"type\": \"number\" },\n \"total\": { \"type\": \"number\" }\n }\n }\n }\n }\n}"
},
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"typeVersion": 1.3,
"position": [
1232,
-384
],
"id": "e70e3e91-3f8f-4c27-bdc9-06a919889c1d",
"name": "Structured Output Parser1"
},
{
"parameters": {
"model": {
"__rl": true,
"value": "gpt-4o-mini",
"mode": "list",
"cachedResultName": "gpt-4o-mini"
},
"builtInTools": {},
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"typeVersion": 1.3,
"position": [
1040,
-384
],
"id": "e21b5672-fadb-47ba-a3ea-f93d8270f1e8",
"name": "OpenAI Chat Model1",
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"promptType": "define",
"text": "=Input info: {{ $json.ParsedResults[0].ParsedText }}",
"hasOutputParser": true,
"options": {
"systemMessage": "=You are an invoice extraction system.\n\nReturn ONLY valid JSON.\n\nSTRICT RULES:\n- No explanations\n- No markdown\n- No text before or after JSON\n- All numbers must be clean numeric values (no symbols, no commas)\n- Fix OCR errors (example: S4,020.oo \u2192 4020)\n- Dates must be strings\n- line_items must be valid array of objects\n- Do not omit required fields\n\nINPUT:\n{{ $json.ParsedResults[0].ParsedText }}"
}
},
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 3,
"position": [
1088,
-608
],
"id": "6c2f43dd-0a04-4794-9ff6-bf7b7dc820b5",
"name": "OCR agent"
},
{
"parameters": {},
"type": "n8n-nodes-base.noOp",
"typeVersion": 1,
"position": [
2560,
-688
],
"id": "ab56f06b-a447-45c2-abb3-69cc86a5169e",
"name": "No Operation, do nothing1"
},
{
"parameters": {
"jsCode": "const items = $input.all();\nconst results = [];\n\nfor (const item of items) {\n const file = item.json;\n \n const mimeType = file.mimeType || '';\n const fileName = file.name || file.originalFilename || '';\n const fileExtension = file.fileExtension || file.fullFileExtension || '';\n\n let detectedType = 'Unknown';\n\n if (mimeType === 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' || fileExtension === 'docx') {\n detectedType = 'Word Document (.docx)';\n } else if (mimeType === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' || fileExtension === 'xlsx') {\n detectedType = 'Excel Spreadsheet (.xlsx)';\n } else if (mimeType === 'application/vnd.openxmlformats-officedocument.presentationml.presentation' || fileExtension === 'pptx') {\n detectedType = 'PowerPoint Presentation (.pptx)';\n } else if (mimeType === 'application/pdf' || fileExtension === 'pdf') {\n detectedType = 'PDF Document (.pdf)';\n } else if (mimeType === 'image/jpeg' || fileExtension === 'jpg' || fileExtension === 'jpeg') {\n detectedType = 'JPEG Image (.jpg)';\n } else if (mimeType === 'image/png' || fileExtension === 'png') {\n detectedType = 'PNG Image (.png)';\n } else if (mimeType === 'text/plain' || fileExtension === 'txt') {\n detectedType = 'Plain Text (.txt)';\n } else if (mimeType === 'application/json' || fileExtension === 'json') {\n detectedType = 'JSON File (.json)';\n } else if (mimeType === 'text/csv' || fileExtension === 'csv') {\n detectedType = 'CSV File (.csv)';\n } else if (mimeType === 'application/vnd.google-apps.document') {\n detectedType = 'Google Doc';\n } else if (mimeType === 'application/vnd.google-apps.spreadsheet') {\n detectedType = 'Google Sheet';\n } else if (mimeType === 'application/vnd.google-apps.presentation') {\n detectedType = 'Google Slides';\n } else if (mimeType) {\n detectedType = mimeType;\n }\n\n results.push({\n json: {\n fileId: file.id,\n fileName: fileName,\n mimeType: mimeType,\n detectedType: detectedType,\n fileExtension: fileExtension || 'none'\n }\n });\n}\n\nreturn results;"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-160,
-304
],
"id": "537c4be5-79cc-4481-80ff-73dfba59de6a",
"name": "File type"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "0449e2e0-066a-4d05-98f1-6bb4f3a537a5",
"leftValue": "={{ $json.mimeType }}",
"rightValue": "image/png",
"operator": {
"type": "string",
"operation": "equals"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
64,
-304
],
"id": "d2a771ae-b3db-4d2c-bfb3-0a2dfd2eff4d",
"name": "If file is"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "196301b4-4b95-46fe-9caf-68d713dcf97f",
"name": "fileName",
"value": "invoice.png",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
288,
-496
],
"id": "313102f5-043c-42a8-97c6-0a6b6a1e518c",
"name": "Set file name"
},
{
"parameters": {
"operation": "download",
"fileId": {
"__rl": true,
"value": "1XAKxPUqcv8rBWjhcpvjuEqX9FDREtgbv",
"mode": "list",
"cachedResultName": "image invoice.png",
"cachedResultUrl": "https://drive.google.com/file/d/1XAKxPUqcv8rBWjhcpvjuEqX9FDREtgbv/view?usp=drivesdk"
},
"options": {}
},
"type": "n8n-nodes-base.googleDrive",
"typeVersion": 3,
"position": [
512,
-496
],
"id": "274cb67c-3c1b-40b0-8171-8edeec373033",
"name": "Download Image invoice",
"credentials": {
"googleDriveOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"method": "POST",
"url": "https://api.ocr.space/parse/image",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "apikey",
"value": "317c34d71c88957"
}
]
},
"sendBody": true,
"contentType": "multipart-form-data",
"bodyParameters": {
"parameters": [
{
"parameterType": "formBinaryData",
"name": "image invoice.png",
"inputDataFieldName": "data"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.3,
"position": [
800,
-496
],
"id": "ecfe4478-9448-4849-93ea-ef51078d5a1d",
"name": "OCR"
},
{
"parameters": {
"jsCode": "const item = $input.first().json;\n\n// Extract invoice from your structure\nconst invoice = item.output;\n\n// Helper to validate fields\nfunction isValid(value) {\n return value !== null && value !== undefined && value !== \"\";\n}\n\n// Required fields for processing\nconst requiredFields = {\n vendor_name: invoice?.vendor?.name,\n invoice_number: invoice?.invoice?.invoice_number,\n invoice_date: invoice?.invoice?.invoice_date,\n due_date: invoice?.invoice?.due_date,\n currency: invoice?.payment?.currency,\n total_amount: invoice?.payment?.total_amount\n};\n\nconst missingFields = [];\n\n// Check missing fields\nfor (const [key, value] of Object.entries(requiredFields)) {\n if (!isValid(value)) {\n missingFields.push(key);\n }\n}\n\n// Final decision\nconst isValidInvoice = missingFields.length === 0;\n\n// Output\nreturn [\n {\n json: {\n is_valid_for_processing: isValidInvoice,\n status: isValidInvoice ? \"READY_TO_PAY\" : \"NEEDS_REVIEW\",\n missing_fields: missingFields,\n\n // useful debug / tracking\n invoice_number: invoice?.invoice?.invoice_number || null,\n vendor: invoice?.vendor?.name || null,\n total_amount: invoice?.payment?.total_amount || null,\n currency: invoice?.payment?.currency || null\n }\n }\n];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1440,
-496
],
"id": "2771632c-8ec3-40ae-b9e1-f36127f1fc2d",
"name": "Fields check"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "9d235c98-ef09-45b8-aab8-4f95f38ff32b",
"leftValue": "={{ $json.status }}",
"rightValue": "READY_TO_PAY",
"operator": {
"type": "string",
"operation": "equals"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
1664,
-496
],
"id": "48f76783-2b36-4eac-8e86-2094cef3229d",
"name": "Ready to pay"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "d7cec1c2-c37a-4cb4-823d-d4418f46dafb",
"name": "invoice_number",
"value": "={{ $json.invoice_number }}",
"type": "string"
},
{
"id": "bdd04433-b63f-4ba4-a1d2-c797304b2c85",
"name": "vendor",
"value": "={{ $json.vendor }}",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
1888,
-592
],
"id": "f9781bfb-f6e8-424d-a878-b7613820fd2a",
"name": "Set File duplicate"
},
{
"parameters": {
"operation": "executeQuery",
"query": "SELECT \n COALESCE(vendor_name, 'NOT_FOUND') AS vendor_name,\n COALESCE(invoice_number, 'NOT_FOUND') AS invoice_number\nFROM invoices\nWHERE vendor_name = '{{$json.vendor}}'\nAND invoice_number = '{{$json.invoice_number}}'\n\nUNION ALL\n\nSELECT \n 'NOT_FOUND' AS vendor_name,\n 'NOT_FOUND' AS invoice_number\nWHERE NOT EXISTS (\n SELECT 1 FROM invoices\n WHERE vendor_name = '{{$json.vendor}}'\n AND invoice_number = '{{$json.invoice_number}}'\n);",
"options": {}
},
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.6,
"position": [
2112,
-592
],
"id": "fa40dc9d-ff60-4c77-ae66-1178859bb9c8",
"name": "Duplicate inquiry",
"alwaysOutputData": true,
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"chatId": "8711656835",
"text": "=The invoice {{ $('Saving original file').item.json.webContentLink }} has missing fields.",
"additionalFields": {}
},
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.2,
"position": [
1888,
-400
],
"id": "b62e0154-6481-4745-b4f4-8bca9decd85a",
"name": "Missing fields message",
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "de571139-d107-4e96-8591-dd771068b679",
"leftValue": "={{ $json.invoice_number }}",
"rightValue": ">0",
"operator": {
"type": "string",
"operation": "equals"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
2336,
-592
],
"id": "7eda3866-7c5e-4981-ab9e-9a6a8dea7de3",
"name": "Duplicate file?"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "60677852-bfc5-4e58-8292-8d7d3a3970b8",
"name": "Bill",
"value": "={{ $('OCR agent').item.json.output.payment.total_amount }}",
"type": "number"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
2560,
-496
],
"id": "9acc5968-62e7-48ca-83d5-9be42ac045dd",
"name": "Set Bill amount"
},
{
"parameters": {
"operation": "sendAndWait",
"chatId": "8711656835",
"message": "=Invoice number {{ $('OCR agent').item.json.output.invoice.invoice_number }} from {{ $('OCR agent').item.json.output.vendor.name }} due on {{ $('OCR agent').item.json.output.invoice.due_date }} has a bill of ${{ $('OCR agent').item.json.output.payment.total_amount }}",
"approvalOptions": {
"values": {
"approvalType": "double",
"approveLabel": "yes",
"disapproveLabel": "No"
}
},
"options": {
"appendAttribution": false
}
},
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.2,
"position": [
3008,
-576
],
"id": "5dd3b9d6-f72f-4d47-8519-c051c7fb73ce",
"name": "Approval",
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "e920495e-d83d-41d2-be87-48f97b1da961",
"leftValue": "={{ $json.Bill }}",
"rightValue": 3000,
"operator": {
"type": "number",
"operation": "gt"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
2784,
-496
],
"id": "1daa5665-9224-4250-aa70-7a09d2ce04ed",
"name": ">$3000"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "3d0098f2-c19b-4613-9df8-34f39e02ae14",
"leftValue": "={{ $json.data.approved }}",
"rightValue": false,
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
3232,
-576
],
"id": "6b376e09-c719-41b4-8c4d-df17193996d4",
"name": "Approved"
},
{
"parameters": {
"operation": "append",
"documentId": {
"__rl": true,
"value": "1wXzaarCmyyXJ2ZVkSUVC1kxnkoInM2mYb9Gx52Xl0c0",
"mode": "list",
"cachedResultName": "Invoice manager",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1wXzaarCmyyXJ2ZVkSUVC1kxnkoInM2mYb9Gx52Xl0c0/edit?usp=drivesdk"
},
"sheetName": {
"__rl": true,
"value": "gid=0",
"mode": "list",
"cachedResultName": "Sheet1",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1wXzaarCmyyXJ2ZVkSUVC1kxnkoInM2mYb9Gx52Xl0c0/edit#gid=0"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"Vendor": "={{ $('OCR agent').item.json.output.vendor.name }}",
"Invoice Number": "={{ $('OCR agent').item.json.output.invoice.invoice_number }}",
"Due Date": "={{ $('OCR agent').item.json.output.invoice.due_date }}",
"Total Due": "={{ $('OCR agent').item.json.output.payment.total_amount }}",
"Status": "Processed"
},
"matchingColumns": [],
"schema": [
{
"id": "Vendor",
"displayName": "Vendor",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Invoice Number",
"displayName": "Invoice Number",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Invoice Date",
"displayName": "Invoice Date",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "Due Date",
"displayName": "Due Date",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Total Due",
"displayName": "Total Due",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Status",
"displayName": "Status",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {}
},
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.7,
"position": [
3472,
-480
],
"id": "5b26194f-12c0-49c9-87c7-af522cbffa0a",
"name": "Processed invoice",
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "bb449baf-e70b-496f-ab17-69517c377c0e",
"name": "=slack_message",
"value": "=`Reminder: Invoice {{ $json['Invoice Number'] }}from {{ $json.Vendor }} worth ${{ $json['Total Due'] }} is due on {{ $json['Due Date'] }}. Please process the payment.`",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
3664,
-480
],
"id": "34dc364f-a059-4cbe-8d88-6ad0220f2071",
"name": "Set message"
},
{
"parameters": {
"select": "channel",
"channelId": {
"__rl": true,
"value": "C0ATKRURALD",
"mode": "list",
"cachedResultName": "marketing"
},
"text": "={{ $json.slack_message }}",
"otherOptions": {
"includeLinkToWorkflow": false
}
},
"type": "n8n-nodes-base.slack",
"typeVersion": 2.3,
"position": [
3888,
-480
],
"id": "ac653c7c-1b23-43a5-8348-34b2e9ad3cd1",
"name": "Invoice processed message",
"credentials": {
"slackApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"operation": "update",
"documentId": {
"__rl": true,
"value": "1wXzaarCmyyXJ2ZVkSUVC1kxnkoInM2mYb9Gx52Xl0c0",
"mode": "list",
"cachedResultName": "Invoice manager",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1wXzaarCmyyXJ2ZVkSUVC1kxnkoInM2mYb9Gx52Xl0c0/edit?usp=drivesdk"
},
"sheetName": {
"__rl": true,
"value": "gid=0",
"mode": "list",
"cachedResultName": "Sheet1",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1wXzaarCmyyXJ2ZVkSUVC1kxnkoInM2mYb9Gx52Xl0c0/edit#gid=0"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"Invoice Number": "={{ $('Processed invoice').item.json['Invoice Number'] }}",
"Status": "Payable"
},
"matchingColumns": [
"Invoice Number"
],
"schema": [
{
"id": "Vendor",
"displayName": "Vendor",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "Invoice Number",
"displayName": "Invoice Number",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "Invoice Date",
"displayName": "Invoice Date",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "Due Date",
"displayName": "Due Date",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "Total Due",
"displayName": "Total Due",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "Status",
"displayName": "Status",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "row_number",
"displayName": "row_number",
"required": false,
"defaultMatch": false,
"display": true,
"type": "number",
"canBeUsedToMatch": true,
"readOnly": true,
"removed": true
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {}
},
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.7,
"position": [
4128,
-592
],
"id": "5969c23f-e153-47fd-b4bd-90bcd9021170",
"name": "Invoice payable",
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"operation": "append",
"documentId": {
"__rl": true,
"value": "1wXzaarCmyyXJ2ZVkSUVC1kxnkoInM2mYb9Gx52Xl0c0",
"mode": "list",
"cachedResultName": "Invoice manager",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1wXzaarCmyyXJ2ZVkSUVC1kxnkoInM2mYb9Gx52Xl0c0/edit?usp=drivesdk"
},
"sheetName": {
"__rl": true,
"value": "gid=0",
"mode": "list",
"cachedResultName": "Sheet1",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1wXzaarCmyyXJ2ZVkSUVC1kxnkoInM2mYb9Gx52Xl0c0/edit#gid=0"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"Vendor": "={{ $('OCR agent').item.json.output.vendor.name }}",
"Invoice Number": "={{ $('OCR agent').item.json.output.invoice.invoice_number }}",
"Invoice Date": "={{ $('OCR agent').item.json.output.invoice.invoice_date }}",
"Due Date": "={{ $('OCR agent').item.json.output.invoice.due_date }}",
"Total Due": "={{ $('OCR agent').item.json.output.payment.total_amount }}",
"Status": "Rejected"
},
"matchingColumns": [],
"schema": [
{
"id": "Vendor",
"displayName": "Vendor",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Invoice Number",
"displayName": "Invoice Number",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Invoice Date",
"displayName": "Invoice Date",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Due Date",
"displayName": "Due Date",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Total Due",
"displayName": "Total Due",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Status",
"displayName": "Status",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {}
},
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.7,
"position": [
3472,
-640
],
"id": "38f1f1a0-6fc3-44b9-ae7a-a24112d2a245",
"name": "Invoice Rejected",
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"schema": {
"__rl": true,
"mode": "list",
"value": "public"
},
"table": {
"__rl": true,
"value": "invoices",
"mode": "list",
"cachedResultName": "invoices"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"vendor_name": "={{ $('Processed invoice').item.json.Vendor }}",
"invoice_number": "={{ $('Processed invoice').item.json['Invoice Number'] }}",
"status": "Pending"
},
"matchingColumns": [
"id"
],
"schema": [
{
"id": "id",
"displayName": "id",
"required": false,
"defaultMatch": true,
"display": true,
"type": "number",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "vendor_name",
"displayName": "vendor_name",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "invoice_number",
"displayName": "invoice_number",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "invoice_date",
"displayName": "invoice_date",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "due_date",
"displayName": "due_date",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "currency",
"displayName": "currency",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "total_amount",
"displayName": "total_amount",
"required": false,
"defaultMatch": false,
"display": true,
"type": "number",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "status",
"displayName": "status",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "created_at",
"displayName": "created_at",
"required": false,
"defaultMatch": false,
"display": true,
"type": "dateTime",
"canBeUsedToMatch": true,
"removed": true
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {}
},
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.6,
"position": [
4128,
-400
],
"id": "c2c4c2e7-49e9-4115-89b6-454db29da9b3",
"name": "Add to database",
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"jsCode": "const item = $input.first().json;\n\n// Extract invoice from your structure\nconst invoice = item.output;\n\n// Helper to validate fields\nfunction isValid(value) {\n return value !== null && value !== undefined && value !== \"\";\n}\n\n// Required fields for processing\nconst requiredFields = {\n vendor_name: invoice?.vendor?.name,\n invoice_number: invoice?.invoice?.invoice_number,\n invoice_date: invoice?.invoice?.invoice_date,\n due_date: invoice?.invoice?.due_date,\n currency: invoice?.payment?.currency,\n total_amount: invoice?.payment?.total_amount\n};\n\nconst missingFields = [];\n\n// Check missing fields\nfor (const [key, value] of Object.entries(requiredFields)) {\n if (!isValid(value)) {\n missingFields.push(key);\n }\n}\n\n// Final decision\nconst isValidInvoice = missingFields.length === 0;\n\n// Output\nreturn [\n {\n json: {\n is_valid_for_processing: isValidInvoice,\n status: isValidInvoice ? \"READY_TO_PAY\" : \"NEEDS_REVIEW\",\n missing_fields: missingFields,\n\n // useful debug / tracking\n invoice_number: invoice?.invoice?.invoice_number || null,\n vendor: invoice?.vendor?.name || null,\n total_amount: invoice?.payment?.total_amount || null,\n currency: invoice?.payment?.currency || null\n }\n }\n];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1152,
-112
],
"id": "f5c9176f-586c-413c-89a3-d75f2eb2b6e3",
"name": "Fields check 2"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "9d235c98-ef09-45b8-aab8-4f95f38ff32b",
"leftValue": "={{ $json.status }}",
"rightValue": "READY_TO_PAY",
"operator": {
"type": "string",
"operation": "equals"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
1440,
-112
],
"id": "4b6dcdc2-488d-4b08-8014-7c1fbc8ec651",
"name": "Ready to pay 2"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "d7cec1c2-c37a-4cb4-823d-d4418f46dafb",
"name": "invoice_number",
"value": "={{ $json.invoice_number }}",
"type": "string"
},
{
"id": "bdd04433-b63f-4ba4-a1d2-c797304b2c85",
"name": "vendor",
"value": "={{ $json.vendor }}",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
1664,
-208
],
"id": "d75b6fc4-5ae0-4c3c-b47d-0c946efe9207",
"name": "Set file duplicate 2"
},
{
"parameters": {
"chatId": "8711656835",
"text": "=The invoice {{ $('Saving original file').item.json.webContentLink }} has missing fields.",
"additionalFields": {}
},
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.2,
"position": [
1664,
-16
],
"id": "1c322692-a268-44bd-99dc-8aa321a204fb",
"name": "Missing fields 2",
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"operation": "executeQuery",
"query": "SELECT \n COALESCE(vendor_name, 'NOT_FOUND') AS vendor_name,\n COALESCE(invoice_number, 'NOT_FOUND') AS invoice_number\nFROM invoices\nWHERE vendor_name = '{{$json.vendor}}'\nAND invoice_number = '{{$json.invoice_number}}'\n\nUNION ALL\n\nSELECT \n 'NOT_FOUND' AS vendor_name,\n 'NOT_FOUND' AS invoice_number\nWHERE NOT EXISTS (\n SELECT 1 FROM invoices\n WHERE vendor_name = '{{$json.vendor}}'\n AND invoice_number = '{{$json.invoice_number}}'\n);",
"options": {}
},
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.6,
"position": [
1888,
-208
],
"id": "f8119498-e578-4e45-8d2b-683079ddb0da",
"name": "Duplicate inquiry 2",
"alwaysOutputData": true,
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "de571139-d107-4e96-8591-dd771068b679",
"leftValue": "={{ $json.invoice_number }}",
"rightValue": ">0",
"operator": {
"type": "string",
"operation": "equals"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
2112,
-208
],
"id": "78321e20-3b5e-4459-a1d4-56353723e42a",
"name": "Duplicate?"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "60677852-bfc5-4e58-8292-8d7d3a3970b8",
"name": "Bill",
"value": "={{ $('AI Agent').item.json.output.payment.total_amount }}",
"type": "number"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
2336,
-112
],
"id": "6087dfaf-321c-492f-bdc4-dde7781984ae",
"name": "Set bill amount 2"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "e920495e-d83d-41d2-be87-48f97b1da961",
"leftValue": "={{ $json.Bill }}",
"rightValue": 3000,
"operator": {
"type": "number",
"operation": "gt"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
2560,
-112
],
"id": "2a64321a-24c4-48ea-8867-86cff9ac2220",
"name": ">$3000 2"
},
{
"parameters": {
"operation": "sendAndWait",
"chatId": "=8711656835",
"message": "=Invoice number from due on has a bill of ",
"approvalOptions": {
"values": {
"approvalType": "double",
"approveLabel": "yes",
"disapproveLabel": "No"
}
},
"options": {}
},
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.2,
"position": [
2784,
-208
],
"id": "fa86973f-72df-4fb7-9138-6b6d28cc8848",
"name": "Approval1",
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "3d0098f2-c19b-4613-9df8-34f39e02ae14",
"leftValue": "={{ $json.data.approved }}",
"rightValue": false,
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
3008,
-208
],
"id": "9a4eb463-a4ba-45c0-96da-ba2e5c95d555",
"name": "Approved?"
},
{
"parameters": {
"operation": "append",
"documentId": {
"__rl": true,
"value": "1wXzaarCmyyXJ2ZVkSUVC1kxnkoInM2mYb9Gx52Xl0c0",
"mode": "list",
"cachedResultName": "Invoice manager",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1wXzaarCmyyXJ2ZVkSUVC1kxnkoInM2mYb9Gx52Xl0c0/edit?usp=drivesdk"
},
"sheetName": {
"__rl": true,
"value": "gid=0",
"mode": "list",
"cachedResultName": "Sheet1",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1wXzaarCmyyXJ2ZVkSUVC1kxnkoInM2mYb9Gx52Xl0c0/edit#gid=0"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"Status": "Rejected"
},
"matchingColumns": [],
"schema": [
{
"id": "Vendor",
"displayName": "Vendor",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Invoice Number",
"displayName": "Invoice Number",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Invoice Date",
"displayName": "Invoice Date",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Due Date",
"displayName": "Due Date",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Total Due",
"displayName": "Total Due",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Status",
"displayName": "Status",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {}
},
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.7,
"position": [
3232,
-256
],
"id": "2d4a8b37-f299-425e-a8a3-8dc9a84265f6",
"name": "Declined invoice",
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "bb449baf-e70b-496f-ab17-69517c377c0e",
"name": "=slack_message",
"value": "=`Reminder: Invoice {{ $json['Invoice Number'] }}from {{ $json.Vendor }} worth ${{ $json['Total Due'] }} is due on {{ $json['Due Date'] }}. Please process the payment.`",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
3440,
-96
],
"id": "c5ffeeab-c65b-4d75-ae74-f644444bd7cb",
"name": "Set message 2"
},
{
"parameters": {
"operation": "append",
"documentId": {
"__rl": true,
"value": "1wXzaarCmyyXJ2ZVkSUVC1kxnkoInM2mYb9Gx52Xl0c0",
"mode": "list",
"cachedResultName": "Invoice manager",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1wXzaarCmyyXJ2ZVkSUVC1kxnkoInM2mYb9Gx52Xl0c0/edit?usp=drivesdk"
},
"sheetName": {
"__rl": true,
"value": "gid=0",
"mode": "list",
"cachedResultName": "Sheet1",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1wXzaarCmyyXJ2ZVkSUVC1kxnkoInM2mYb9Gx52Xl0c0/edit#gid=0"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"Vendor": "={{ $('AI Agent').item.json.output.vendor.name }}",
"Invoice Number": "={{ $('AI Agent').item.json.output.invoice.invoice_number }}",
"Invoice Date": "={{ $('AI Agent').item.json.output.invoice.invoice_date }}",
"Due Date": "={{ $('AI Agent').item.json.output.invoice.due_date }}",
"Total Due": "={{ $('AI Agent').item.json.output.payment.total_amount }}"
},
"matchingColumns": [],
"schema": [
{
"id": "Vendor",
"displayName": "Vendor",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Invoice Number",
"displayName": "Invoice Number",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Invoice Date",
"displayName": "Invoice Date",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Due Date",
"displayName": "Due Date",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Total Due",
"displayName": "Total Due",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "Status",
"displayName": "Status",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {}
},
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.7,
"position": [
3232,
-96
],
"id": "f41b1525-aa37-409a-961e-0b6b3d39be3a",
"name": "Processed invoice 2",
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"select": "channel",
"channelId": {
"__rl": true,
"value": "C0ATKRURALD",
"mode": "list",
"cachedResultName": "marketing"
},
"text": "={{ $json.slack_message }}",
"otherOptions": {
"includeLinkToWorkflow": false
}
},
"type": "n8n-nodes-base.slack",
"typeVersion": 2.3,
"position": [
3664,
-96
],
"id": "9d7c4953-2efc-4e86-be67-afd2587cda99",
"name": "Invoice processed message 2",
"credentials": {
"slackApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"operation": "update",
"documentId": {
"__rl": true,
"value": "1wXzaarCmyyXJ2ZVkSUVC1kxnkoInM2mYb9Gx52Xl0c0",
"mode": "list",
"cachedResultName": "Invoice manager",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1wXzaarCmyyXJ2ZVkSUVC1kxnkoInM2mYb9Gx52Xl0c0/edit?usp=drivesdk"
},
"sheetName": {
"__rl": true,
"value": "gid=0",
"mode": "list",
"cachedResultName": "Sheet1",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1wXzaarCmyyXJ2ZVkSUVC1kxnkoInM2mYb9Gx52Xl0c0/edit#gid=0"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"Invoice Number": "={{ $('Processed invoice 2').item.json['Invoice Number'] }}",
"Status": "Payable"
},
"matchingColumns": [
"Invoice Number"
],
"schema": [
{
"id": "Vendor",
"displayName": "Vendor",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "Invoice Number",
"displayName": "Invoice Number",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "Invoice Date",
"displayName": "Invoice Date",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "Due Date",
"displayName": "Due Date",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "Total Due",
"displayName": "Total Due",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "Status",
"displayName": "Status",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "row_number",
"displayName": "row_number",
"required": false,
"defaultMatch": false,
"display": true,
"type": "number",
"canBeUsedToMatch": true,
"readOnly": true,
"removed": true
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {}
},
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.7,
"position": [
3904,
-208
],
"id": "ccd1c7e4-5f8e-4e1b-89eb-4966618b5ab1",
"name": "Invoice Payable 2",
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"schema": {
"__rl": true,
"mode": "list",
"value": "public"
},
"table": {
"__rl": true,
"value": "invoices",
"mode": "list",
"cachedResultName": "invoices"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"vendor_name": "={{ $('Processed invoice 2').item.json.Vendor }}",
"invoice_number": "={{ $('Processed invoice 2').item.json['Invoice Number'] }}",
"status": "Pending"
},
"matchingColumns": [
"id"
],
"schema": [
{
"id": "id",
"displayName": "id",
"required": false,
"defaultMatch": true,
"display": true,
"type": "number",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "vendor_name",
"displayName": "vendor_name",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "invoice_number",
"displayName": "invoice_number",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "invoice_date",
"displayName": "invoice_date",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": true
},
{
"id": "due_date",
"displayName"
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
gmailOAuth2googleDriveOAuth2ApigoogleSheetsOAuth2ApiopenAiApipostgresslackApitelegramApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Portfolio 1: Invoice manager. Uses gmailTrigger, googleDrive, agent, lmChatOpenAi. Event-driven trigger; 54 nodes.
Source: https://gist.github.com/meeramnoor16/eedf23c8dede444019b16cfd7b3fa448 — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
🎯 Create viral TikToks, Shorts, Reels, podcasts, and ASMR videos in minutes — all on autopilot.
Generate AI viral videos with NanoBanana & VEO3, shared on socials via Blotato 2. Uses @blotato/n8n-nodes-blotato, googleSheets, lmChatOpenAi, toolThink. Event-driven trigger; 94 nodes.
Inbox Guardian. Uses gmailTrigger, lmChatOpenAi, agent, textClassifier. Event-driven trigger; 66 nodes.
> Note: This workflow uses sticky notes extensively to document each logical section of the automation. Sticky notes are mandatory and already included to explain OCR, AI parsing, folder logic, dup
This template is designed for marketers, content creators, and e-commerce brands who want to automate the creation of professional ad videos at scale. It’s ideal for teams looking to generate consiste