有发票附件?
高级
这是一个自动化工作流,包含 22 个节点。主要使用 If, Code, Gmail, Slack, Quickbooks 等节点。 使用 GPT-4o 欺诈检测和 QuickBooks 自动提取并审批发票
前置要求
- •Google 账号和 Gmail API 凭证
- •Slack Bot Token 或 Webhook URL
- •Google Sheets API 凭证
- •OpenAI API Key
使用的节点 (22)
分类
-
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "KMgt49BPco6oE5Xj",
"meta": {
"instanceId": "277842713620d9f5554de3b1518b865a152c8c4db680008bd8aec536fc18b4a8"
},
"name": "有发票附件?",
"tags": [
{
"id": "CWardZYJBmejoyC4",
"name": "under review",
"createdAt": "2025-10-09T18:43:37.031Z",
"updatedAt": "2025-10-09T18:43:37.031Z"
}
],
"nodes": [
{
"id": "2855123e-800d-426d-9adc-35b4fcbbbd65",
"name": "提取发票附件",
"type": "n8n-nodes-base.if",
"position": [
-1264,
256
],
"parameters": {
"options": {},
"conditions": {
"options": {
"caseSensitive": false
},
"combinator": "and",
"conditions": [
{
"id": "has-attachment",
"operator": {
"type": "boolean",
"operation": "true"
},
"leftValue": "={{ $json.attachments?.length > 0 }}",
"rightValue": true
}
]
}
},
"typeVersion": 2.2
},
{
"id": "6177f958-e010-426b-8d7a-1d9f2966eaed",
"name": "AI发票OCR与提取",
"type": "n8n-nodes-base.code",
"position": [
-736,
192
],
"parameters": {
"jsCode": "const items = $input.all();\nconst results = [];\n\nfor (const item of items) {\n const attachments = item.json.attachments || [];\n \n // Filter for PDF and image attachments (common invoice formats)\n const invoiceAttachments = attachments.filter(att => {\n const name = att.filename?.toLowerCase() || '';\n return name.endsWith('.pdf') || \n name.endsWith('.png') || \n name.endsWith('.jpg') || \n name.endsWith('.jpeg');\n });\n \n // Process each invoice attachment\n for (const attachment of invoiceAttachments) {\n results.push({\n json: {\n email_from: item.json.from,\n email_subject: item.json.subject,\n email_date: item.json.date,\n email_id: item.json.id,\n attachment_name: attachment.filename,\n attachment_id: attachment.attachmentId,\n attachment_size: attachment.size,\n invoice_id: `INV-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`\n },\n binary: {\n data: item.binary[attachment.attachmentId]\n }\n });\n }\n}\n\nreturn results;"
},
"typeVersion": 2
},
{
"id": "49036c5c-fdc0-47d0-8885-63dcd931f2e2",
"name": "AI欺诈检测代理",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
-576,
192
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini"
},
"options": {
"temperature": 0.1
},
"messages": {
"values": [
{
"content": "=You are an expert invoice processing AI. Extract ALL information from this invoice document with perfect accuracy.\n\n**Email Context:**\nFrom: {{ $json.email_from }}\nSubject: {{ $json.email_subject }}\nDate: {{ $json.email_date }}\n\nAnalyze the attached invoice image/PDF and extract complete structured information. Return ONLY valid JSON with this exact structure:\n\n{\n \"vendor_name\": \"Company Name\",\n \"vendor_email\": \"vendor@email.com\",\n \"vendor_address\": \"Full address\",\n \"vendor_tax_id\": \"Tax/VAT ID if present\",\n \"invoice_number\": \"INV-12345\",\n \"invoice_date\": \"YYYY-MM-DD\",\n \"due_date\": \"YYYY-MM-DD\",\n \"po_number\": \"PO number if referenced\",\n \"currency\": \"USD\",\n \"line_items\": [\n {\n \"description\": \"Item description\",\n \"quantity\": 1,\n \"unit_price\": 100.00,\n \"total\": 100.00\n }\n ],\n \"subtotal\": 100.00,\n \"tax_amount\": 8.00,\n \"tax_rate\": 8.0,\n \"shipping\": 0.00,\n \"total_amount\": 108.00,\n \"payment_terms\": \"Net 30\",\n \"notes\": \"Any special notes or terms\",\n \"bank_details\": \"Bank account information if present\",\n \"invoice_category\": \"software|hardware|services|consulting|office_supplies|utilities|marketing|travel|other\",\n \"confidence_score\": 0.95\n}\n\nIMPORTANT:\n- Extract exact amounts with 2 decimal places\n- Use YYYY-MM-DD format for dates\n- If information is missing, use null\n- Be extremely accurate with numbers\n- Classify invoice into appropriate category\n- Confidence score 0-1 based on document clarity"
}
]
}
},
"credentials": {
"openAiApi": {
"id": "8IkhtT3EbXygnvcr",
"name": "Klinsman OpenAI"
}
},
"typeVersion": 1.8
},
{
"id": "e82f7d85-e1d2-408b-a3ce-b5e12993763d",
"name": "解析发票数据",
"type": "n8n-nodes-base.code",
"position": [
-288,
192
],
"parameters": {
"jsCode": "const items = $input.all();\nconst results = [];\n\nfor (const item of items) {\n try {\n // Parse AI response\n const aiText = item.json.message?.content || item.json.output || '{}';\n \n // Clean JSON\n let cleanJson = aiText.replace(/```json\\n?/g, '').replace(/```\\n?/g, '').trim();\n const jsonMatch = cleanJson.match(/\\{[\\s\\S]*\\}/);\n if (jsonMatch) {\n cleanJson = jsonMatch[0];\n }\n \n const invoiceData = JSON.parse(cleanJson);\n \n // Get original email data\n const originalData = $('Extract Invoice Attachments').item(0).json;\n \n results.push({\n json: {\n ...originalData,\n ...invoiceData,\n parsed_at: new Date().toISOString(),\n processing_status: 'extracted'\n }\n });\n } catch (error) {\n results.push({\n json: {\n ...item.json,\n parsing_error: error.message,\n processing_status: 'failed'\n }\n });\n }\n}\n\nreturn results;"
},
"typeVersion": 2
},
{
"id": "2aedc6f8-75f4-4ae3-a562-39f270728a28",
"name": "严重欺诈风险?",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
16,
144
],
"parameters": {
"text": "=You are a financial fraud detection AI with expertise in identifying invoice anomalies, duplicate submissions, and fraudulent patterns.\n\nAnalyze this invoice for potential fraud, anomalies, or issues:\n\n## INVOICE DETAILS\n**Vendor:** {{ $json.vendor_name }}\n**Invoice Number:** {{ $json.invoice_number }}\n**Date:** {{ $json.invoice_date }}\n**Due Date:** {{ $json.due_date }}\n**Amount:** {{ $json.currency }} {{ $json.total_amount }}\n**Category:** {{ $json.invoice_category }}\n**PO Number:** {{ $json.po_number || 'None' }}\n**Email From:** {{ $json.email_from }}\n\n**Line Items:**\n{{ $json.line_items.map(item => `- ${item.description}: ${item.quantity} × $${item.unit_price} = $${item.total}`).join('\\n') }}\n\n**Payment Terms:** {{ $json.payment_terms }}\n\n---\n\n## FRAUD DETECTION CRITERIA\n\n### Red Flags to Check:\n1. **Duplicate Invoice Detection**\n - Similar amounts recently processed\n - Same invoice number from this vendor\n - Duplicate line item descriptions\n\n2. **Amount Anomalies**\n - Unusually high amount for vendor/category\n - Round numbers (possible fake invoices)\n - Amount just under approval threshold (splitting)\n\n3. **Vendor Verification**\n - New/unknown vendor\n - Mismatched email domain vs vendor name\n - Missing tax ID or business details\n - Suspicious bank details\n\n4. **Document Quality Issues**\n - Low confidence score from OCR\n - Missing critical information\n - Unprofessional formatting\n - Mismatched totals or calculations\n\n5. **Timing Anomalies**\n - Invoice date in future\n - Very old invoice\n - Due date already passed\n - Weekend/holiday invoice dates\n\n6. **Pattern Detection**\n - Frequent small invoices (just under approval limit)\n - Vague descriptions (\"consulting services\")\n - No PO number for large amounts\n - Rush payment requests\n\n### Category-Specific Checks:\n- **Software/SaaS:** Check if subscription-based, verify renewal dates\n- **Consulting:** Verify hourly rates are reasonable\n- **Travel:** Check dates align with known business trips\n- **Office Supplies:** Verify quantities are reasonable\n\n---\n\n## YOUR ANALYSIS TASK\n\nProvide detailed fraud risk assessment covering:\n\n1. **Overall Risk Level** - critical/high/medium/low with clear reasoning\n\n2. **Specific Red Flags Found** - List all anomalies detected\n\n3. **Vendor Trust Score** - Rate vendor legitimacy (0-100)\n\n4. **Amount Validation** - Is the amount reasonable for this category?\n\n5. **Document Quality Score** - Rate invoice professionalism (0-100)\n\n6. **Duplicate Risk** - Likelihood this is a duplicate submission\n\n7. **Recommended Action** - auto_approve / manager_review / fraud_investigation / reject\n\n8. **Required Verifications** - What should be manually verified\n\n9. **Approval Workflow** - Who should approve based on amount/risk\n\n10. **Priority Level** - urgent / high / normal / low\n\nBe thorough and err on the side of caution. Flag anything suspicious for human review.",
"options": {},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 2.2
},
{
"id": "d79e193d-8f8e-4f63-bc5d-87af7ebd3e42",
"name": "OpenAI 聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
-16,
416
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini"
},
"options": {
"temperature": 0.2
}
},
"credentials": {
"openAiApi": {
"id": "8IkhtT3EbXygnvcr",
"name": "Klinsman OpenAI"
}
},
"typeVersion": 1.2
},
{
"id": "b07f6e14-d650-4da4-845f-191d76249aa6",
"name": "结构化输出解析器",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
176,
416
],
"parameters": {
"schemaType": "manual",
"inputSchema": "{\n \"type\": \"object\",\n \"required\": [\n \"risk_level\",\n \"risk_score\",\n \"red_flags\",\n \"vendor_trust_score\",\n \"amount_validation\",\n \"document_quality_score\",\n \"duplicate_risk\",\n \"recommended_action\",\n \"required_verifications\",\n \"approval_workflow\",\n \"priority_level\",\n \"detailed_analysis_markdown\"\n ],\n \"properties\": {\n \"risk_level\": {\n \"type\": \"string\",\n \"enum\": [\"critical\", \"high\", \"medium\", \"low\"]\n },\n \"risk_score\": {\n \"type\": \"integer\",\n \"minimum\": 0,\n \"maximum\": 100,\n \"description\": \"Overall fraud risk score\"\n },\n \"red_flags\": {\n \"type\": \"array\",\n \"items\": {\"type\": \"string\"},\n \"description\": \"List of specific concerns found\"\n },\n \"vendor_trust_score\": {\n \"type\": \"integer\",\n \"minimum\": 0,\n \"maximum\": 100\n },\n \"amount_validation\": {\n \"type\": \"string\",\n \"description\": \"Is amount reasonable? Details\"\n },\n \"document_quality_score\": {\n \"type\": \"integer\",\n \"minimum\": 0,\n \"maximum\": 100\n },\n \"duplicate_risk\": {\n \"type\": \"string\",\n \"enum\": [\"none\", \"low\", \"medium\", \"high\", \"confirmed\"]\n },\n \"recommended_action\": {\n \"type\": \"string\",\n \"enum\": [\"auto_approve\", \"manager_review\", \"cfo_approval\", \"fraud_investigation\", \"reject\"]\n },\n \"required_verifications\": {\n \"type\": \"array\",\n \"items\": {\"type\": \"string\"}\n },\n \"approval_workflow\": {\n \"type\": \"string\",\n \"description\": \"Who should approve\"\n },\n \"priority_level\": {\n \"type\": \"string\",\n \"enum\": [\"urgent\", \"high\", \"normal\", \"low\"]\n },\n \"detailed_analysis_markdown\": {\n \"type\": \"string\",\n \"description\": \"Full analysis in markdown\"\n }\n }\n}"
},
"typeVersion": 1.3
},
{
"id": "5f940f8a-f146-4438-b87d-e85b294095bb",
"name": "自动批准符合条件?",
"type": "n8n-nodes-base.if",
"position": [
400,
96
],
"parameters": {
"options": {},
"conditions": {
"options": {},
"combinator": "or",
"conditions": [
{
"id": "critical-risk",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.output.risk_level }}",
"rightValue": "critical"
},
{
"id": "fraud-investigation",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.output.recommended_action }}",
"rightValue": "fraud_investigation"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "7ca0fa2f-183d-41fb-b654-bd39481ffc99",
"name": "请求欺诈调查",
"type": "n8n-nodes-base.if",
"position": [
416,
352
],
"parameters": {
"options": {},
"conditions": {
"options": {},
"combinator": "and",
"conditions": [
{
"id": "auto-approve",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.output.recommended_action }}",
"rightValue": "auto_approve"
},
{
"id": "low-risk-and-small",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.output.risk_level }}",
"rightValue": "low"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "7f4ffb88-3c0a-4ee2-90bf-f6139eeb62e2",
"name": "金额 > $5000?",
"type": "n8n-nodes-base.gmail",
"position": [
1296,
-16
],
"webhookId": "fraud-investigation-webhook",
"parameters": {
"sendTo": "finance-manager@yourcompany.com",
"message": "=<!DOCTYPE html>\n<html>\n<head>\n<style>\nbody{font-family:Arial,sans-serif;line-height:1.6;color:#333;max-width:700px;margin:0 auto;padding:20px}\n.alert-banner{background:#dc3545;color:#fff;padding:20px;text-align:center;border-radius:8px 8px 0 0;font-size:20px;font-weight:bold}\n.content{background:#fff;padding:30px;border:3px solid #dc3545}\n.risk-grid{display:grid;grid-template-columns:1fr 1fr 1fr;gap:15px;margin:20px 0}\n.risk-box{background:#fff3cd;padding:15px;text-align:center;border-radius:5px;border:2px solid #ffc107}\n.risk-box.critical{background:#f8d7da;border-color:#dc3545}\n.risk-box strong{display:block;font-size:28px;color:#dc3545;margin-bottom:5px}\n.red-flags{background:#f8d7da;padding:15px;border-left:4px solid #dc3545;margin:20px 0}\n.invoice-details{background:#f8f9fa;padding:15px;border-radius:5px;margin:20px 0}\n</style>\n</head>\n<body>\n<div class=\"alert-banner\">🚨 CRITICAL FRAUD ALERT 🚨</div>\n<div class=\"content\">\n<p><strong>A potentially fraudulent invoice has been detected and requires immediate investigation.</strong></p>\n\n<div class=\"invoice-details\">\n<h3 style=\"margin-top:0;color:#dc3545\">Invoice Information</h3>\n<p><strong>Vendor:</strong> {{ $('Parse Invoice Data').item.json.vendor_name }}<br>\n<strong>Invoice Number:</strong> {{ $('Parse Invoice Data').item.json.invoice_number }}<br>\n<strong>Amount:</strong> {{ $('Parse Invoice Data').item.json.currency }} {{ $('Parse Invoice Data').item.json.total_amount }}<br>\n<strong>Date:</strong> {{ $('Parse Invoice Data').item.json.invoice_date }}<br>\n<strong>Due Date:</strong> {{ $('Parse Invoice Data').item.json.due_date }}<br>\n<strong>Category:</strong> {{ $('Parse Invoice Data').item.json.invoice_category }}<br>\n<strong>PO Number:</strong> {{ $('Parse Invoice Data').item.json.po_number || 'None provided' }}</p>\n</div>\n\n<div class=\"risk-grid\">\n<div class=\"risk-box critical\"><strong>{{ $json.output.risk_score }}</strong>Risk Score</div>\n<div class=\"risk-box\"><strong>{{ $json.output.vendor_trust_score }}</strong>Vendor Trust</div>\n<div class=\"risk-box\"><strong>{{ $json.output.document_quality_score }}</strong>Doc Quality</div>\n</div>\n\n<div class=\"red-flags\">\n<h3 style=\"margin-top:0;color:#dc3545\">⚠️ Red Flags Detected</h3>\n<ul style=\"margin:0;padding-left:20px\">\n{{ $json.output.red_flags.map(flag => '<li><strong>' + flag + '</strong></li>').join('') }}\n</ul>\n</div>\n\n<h3>Required Verifications:</h3>\n<ul>\n{{ $json.output.required_verifications.map(ver => '<li>' + ver + '</li>').join('') }}\n</ul>\n\n<h3>AI Recommendation:</h3>\n<p style=\"font-size:18px;color:#dc3545\"><strong>{{ $json.output.recommended_action.toUpperCase().replace('_', ' ') }}</strong></p>\n\n<p><strong>⏰ This invoice has been BLOCKED from payment pending your investigation.</strong></p>\n\n<p>Please review immediately and take appropriate action.</p>\n\n<p style=\"margin-top:30px;padding-top:20px;border-top:1px solid #ddd;font-size:12px;color:#666\">\n<strong>Invoice ID:</strong> {{ $('Parse Invoice Data').item.json.invoice_id }}<br>\n<strong>Detected:</strong> {{ $('Parse Invoice Data').item.json.parsed_at }}\n</p>\n</div>\n</body>\n</html>",
"options": {},
"subject": "=⚠️ URGENT: Suspicious Invoice Requires Investigation - {{ $('Parse Invoice Data').item.json.vendor_name }}",
"operation": "sendAndWait"
},
"credentials": {
"gmailOAuth2": {
"id": "PIMDNhXNj8Zyiz3G",
"name": "Gmail account - Deepanshi"
}
},
"typeVersion": 2.1
},
{
"id": "4de0ce06-d062-4c0d-a006-3dda68257db0",
"name": "请求经理批准",
"type": "n8n-nodes-base.if",
"position": [
880,
192
],
"parameters": {
"options": {},
"conditions": {
"options": {},
"conditions": [
{
"id": "amount-check",
"operator": {
"type": "number",
"operation": "larger"
},
"leftValue": "={{ $('Parse Invoice Data').item.json.total_amount }}",
"rightValue": "5000"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "8b3d632f-fb06-4f4c-bbe7-00012fe7581e",
"name": "通知供应商 - 已批准",
"type": "n8n-nodes-base.gmail",
"position": [
1312,
176
],
"webhookId": "manager-approval-webhook",
"parameters": {
"sendTo": "finance-manager@yourcompany.com",
"message": "=<!DOCTYPE html>\n<html>\n<head>\n<style>\nbody{font-family:Arial,sans-serif;line-height:1.6;color:#333;max-width:700px;margin:0 auto;padding:20px}\n.header{background:linear-gradient(135deg,#667eea 0%,#764ba2 100%);color:#fff;padding:25px;text-align:center;border-radius:8px 8px 0 0}\n.content{background:#fff;padding:30px;border:1px solid #ddd}\n.info-grid{display:grid;grid-template-columns:1fr 1fr;gap:15px;margin:20px 0}\n.info-box{background:#f8f9fa;padding:15px;border-radius:5px}\n.score-box{background:#d4edda;padding:15px;text-align:center;border-radius:5px;border:2px solid #28a745}\n.score-box strong{display:block;font-size:24px;color:#28a745}\n.line-items{background:#f8f9fa;padding:15px;border-radius:5px;margin:20px 0}\ntable{width:100%;border-collapse:collapse}\ntable th{background:#667eea;color:#fff;padding:10px;text-align:left}\ntable td{padding:10px;border-bottom:1px solid #ddd}\n</style>\n</head>\n<body>\n<div class=\"header\">\n<h2 style=\"margin:0\">📄 Invoice Approval Required</h2>\n<p style=\"margin:5px 0 0 0\">{{ $('Parse Invoice Data').item.json.vendor_name }}</p>\n</div>\n<div class=\"content\">\n<div class=\"info-grid\">\n<div class=\"info-box\">\n<strong>Invoice Number:</strong> {{ $('Parse Invoice Data').item.json.invoice_number }}<br>\n<strong>Date:</strong> {{ $('Parse Invoice Data').item.json.invoice_date }}<br>\n<strong>Due Date:</strong> {{ $('Parse Invoice Data').item.json.due_date }}\n</div>\n<div class=\"info-box\">\n<strong>Amount:</strong> {{ $('Parse Invoice Data').item.json.currency }} {{ $('Parse Invoice Data').item.json.total_amount }}<br>\n<strong>Category:</strong> {{ $('Parse Invoice Data').item.json.invoice_category }}<br>\n<strong>PO #:</strong> {{ $('Parse Invoice Data').item.json.po_number || 'N/A' }}\n</div>\n</div>\n\n<div class=\"score-box\">\n<strong>{{ $json.output.vendor_trust_score }}</strong>\nVendor Trust Score (Low Risk)\n</div>\n\n<div class=\"line-items\">\n<h3 style=\"margin-top:0\">Line Items</h3>\n<table>\n<thead>\n<tr><th>Description</th><th>Qty</th><th>Unit Price</th><th>Total</th></tr>\n</thead>\n<tbody>\n{{ $('Parse Invoice Data').item.json.line_items.map(item => '<tr><td>' + item.description + '</td><td>' + item.quantity + '</td><td>$' + item.unit_price.toFixed(2) + '</td><td>$' + item.total.toFixed(2) + '</td></tr>').join('') }}\n<tr style=\"font-weight:bold;background:#f8f9fa\"><td colspan=\"3\">Subtotal</td><td>${{ $('Parse Invoice Data').item.json.subtotal.toFixed(2) }}</td></tr>\n<tr><td colspan=\"3\">Tax ({{ $('Parse Invoice Data').item.json.tax_rate }}%)</td><td>${{ $('Parse Invoice Data').item.json.tax_amount.toFixed(2) }}</td></tr>\n<tr style=\"font-weight:bold;font-size:18px;background:#667eea;color:#fff\"><td colspan=\"3\">TOTAL</td><td>${{ $('Parse Invoice Data').item.json.total_amount.toFixed(2) }}</td></tr>\n</tbody>\n</table>\n</div>\n\n<h3>AI Analysis Summary:</h3>\n<p><strong>Risk Level:</strong> {{ $json.output.risk_level.toUpperCase() }}<br>\n<strong>Recommendation:</strong> {{ $json.output.recommended_action.replace('_', ' ').toUpperCase() }}</p>\n\n{{ $json.output.red_flags.length > 0 ? '<h3>⚠️ Items to Verify:</h3><ul>' + $json.output.red_flags.map(flag => '<li>' + flag + '</li>').join('') + '</ul>' : '<p>✅ No issues detected</p>' }}\n\n<p><strong>Payment Terms:</strong> {{ $('Parse Invoice Data').item.json.payment_terms }}</p>\n\n<p style=\"margin-top:30px\"><strong>Please approve or reject this invoice.</strong></p>\n</div>\n</body>\n</html>",
"options": {},
"subject": "=Invoice Approval Required - {{ $('Parse Invoice Data').item.json.vendor_name }} - ${{ $('Parse Invoice Data').item.json.total_amount }}",
"operation": "sendAndWait"
},
"typeVersion": 2.1
},
{
"id": "e7d4d4b9-f1a7-49c2-acb2-bf66d102fe29",
"name": "记录到发票数据库",
"type": "n8n-nodes-base.gmail",
"position": [
1328,
368
],
"webhookId": "c9c97d37-6231-4e60-8d68-252db4f5399f",
"parameters": {
"sendTo": "={{ $('Parse Invoice Data').item.json.email_from }}",
"message": "=<!DOCTYPE html>\n<html>\n<head>\n<style>\nbody{font-family:Arial,sans-serif;line-height:1.6;color:#333;max-width:600px;margin:0 auto;padding:20px}\n.header{background:#28a745;color:#fff;padding:20px;text-align:center;border-radius:8px 8px 0 0}\n.content{background:#fff;padding:30px;border:1px solid #ddd}\n.info-box{background:#f8f9fa;padding:15px;border-radius:5px;margin:20px 0}\n</style>\n</head>\n<body>\n<div class=\"header\"><h2 style=\"margin:0\">✅ Invoice Approved</h2></div>\n<div class=\"content\">\n<p>Dear {{ $('Parse Invoice Data').item.json.vendor_name }},</p>\n<p>Thank you for your invoice. We've received and automatically processed it.</p>\n<div class=\"info-box\">\n<strong>Invoice Number:</strong> {{ $('Parse Invoice Data').item.json.invoice_number }}<br>\n<strong>Amount:</strong> {{ $('Parse Invoice Data').item.json.currency }} {{ $('Parse Invoice Data').item.json.total_amount }}<br>\n<strong>Due Date:</strong> {{ $('Parse Invoice Data').item.json.due_date }}<br>\n<strong>Status:</strong> Approved for Payment\n</div>\n<p>Payment will be processed according to terms: <strong>{{ $('Parse Invoice Data').item.json.payment_terms }}</strong></p>\n<p>Expected payment date: <strong>{{ $('Parse Invoice Data').item.json.due_date }}</strong></p>\n<p>If you have questions, please reply to this email.</p>\n<p>Best regards,<br><strong>Accounts Payable</strong><br>[Your Company]</p>\n</div>\n</body>\n</html>",
"options": {},
"subject": "=Invoice Received & Processing - {{ $('Parse Invoice Data').item.json.invoice_number }}"
},
"typeVersion": 2.1
},
{
"id": "33787ce5-b0ef-46f2-9687-6d88d4effb55",
"name": "便签 - 接收",
"type": "n8n-nodes-base.googleSheets",
"position": [
1840,
272
],
"parameters": {
"columns": {
"value": {
"amount": "={{ $('Parse Invoice Data').item.json.total_amount }}",
"status": "={{ $json.status || 'Processed' }}",
"category": "={{ $('Parse Invoice Data').item.json.invoice_category }}",
"currency": "={{ $('Parse Invoice Data').item.json.currency }}",
"due_date": "={{ $('Parse Invoice Data').item.json.due_date }}",
"po_number": "={{ $('Parse Invoice Data').item.json.po_number }}",
"red_flags": "={{ $json.output.red_flags.join('; ') }}",
"invoice_id": "={{ $('Parse Invoice Data').item.json.invoice_id }}",
"risk_level": "={{ $json.output.risk_level }}",
"risk_score": "={{ $json.output.risk_score }}",
"vendor_name": "={{ $('Parse Invoice Data').item.json.vendor_name }}",
"invoice_date": "={{ $('Parse Invoice Data').item.json.invoice_date }}",
"vendor_email": "={{ $('Parse Invoice Data').item.json.vendor_email }}",
"vendor_trust": "={{ $json.output.vendor_trust_score }}",
"duplicate_risk": "={{ $json.output.duplicate_risk }}",
"invoice_number": "={{ $('Parse Invoice Data').item.json.invoice_number }}",
"processed_date": "={{ $('Parse Invoice Data').item.json.parsed_at }}",
"recommended_action": "={{ $json.output.recommended_action }}"
},
"mappingMode": "defineBelow"
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "YOUR_GOOGLE_SHEET_ID"
}
},
"typeVersion": 4.5
},
{
"id": "e510ac2c-183f-4f6b-bea0-1573cb6af792",
"name": "## 📧 智能发票接收",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1568,
64
],
"parameters": {
"color": 5,
"width": 674,
"height": 388,
"content": "便签 - OCR"
},
"typeVersion": 1
},
{
"id": "e03f3fdf-80c2-4c87-9e05-58f499853191",
"name": "## 🤖 AI驱动的OCR与数据提取",
"type": "n8n-nodes-base.stickyNote",
"position": [
-800,
0
],
"parameters": {
"color": 4,
"width": 674,
"height": 444,
"content": "便签 - 欺诈"
},
"typeVersion": 1
},
{
"id": "69a627b2-fc15-440b-9668-f7cead11c022",
"name": "## 🚨 AI欺诈检测与风险分析",
"type": "n8n-nodes-base.stickyNote",
"position": [
-64,
-48
],
"parameters": {
"color": 6,
"width": 756,
"height": 692,
"content": "便签 - 路由"
},
"typeVersion": 1
},
{
"id": "8a173f21-6a0a-4428-916e-801b83eb1dda",
"name": "## 🚦 智能路由与审批工作流",
"type": "n8n-nodes-base.stickyNote",
"position": [
800,
-176
],
"parameters": {
"color": 3,
"width": 720,
"height": 772,
"content": "便签 - 分析"
},
"typeVersion": 1
},
{
"id": "30f7ee03-153b-4ab6-86ce-f01e014e42d1",
"name": "## 📊 财务分析与审计追踪",
"type": "n8n-nodes-base.stickyNote",
"position": [
1632,
96
],
"parameters": {
"color": 7,
"width": 480,
"height": 364,
"content": "更新发票"
},
"typeVersion": 1
},
{
"id": "399c8b7f-a346-4cab-a49f-337b8b1605f4",
"name": "发送消息",
"type": "n8n-nodes-base.slack",
"position": [
992,
0
],
"webhookId": "9d823dcf-d08f-4c87-aef9-d9cb2b4b542a",
"parameters": {
"text": "=:rotating_light: *CRITICAL FRAUD ALERT* :rotating_light:\\n\\n*Invoice Details:*\\nVendor: {{ $('Parse Invoice Data').item.json.vendor_name }}\\nAmount: {{ $('Parse Invoice Data').item.json.currency }} {{ $('Parse Invoice Data').item.json.total_amount }}\\nInvoice #: {{ $('Parse Invoice Data').item.json.invoice_number }}\\n\\n*Risk Assessment:*\\nRisk Level: {{ $json.output.risk_level.toUpperCase() }}\\nRisk Score: {{ $json.output.risk_score }}/100\\nVendor Trust: {{ $json.output.vendor_trust_score }}/100\\n\\n*Red Flags:*\\n{{ $json.output.red_flags.map(flag => '• ' + flag).join('\\\\n') }}\\n\\n*Recommended Action:* {{ $json.output.recommended_action.toUpperCase().replace('_', ' ') }}\\n\\n:warning: *IMMEDIATE ACTION REQUIRED* - Do NOT process this invoice until investigated!",
"select": "channel",
"channelId": {
"__rl": true,
"mode": "list",
"value": ""
},
"otherOptions": {}
},
"typeVersion": 2.3
},
{
"id": "87e7a15b-abbc-4fbc-b1ba-fe987c2740c8",
"name": "语言",
"type": "n8n-nodes-base.quickbooks",
"position": [
1104,
368
],
"parameters": {
"resource": "invoice",
"operation": "update",
"updateFields": {}
},
"typeVersion": 1
},
{
"id": "8faf07af-b384-43d9-910e-ad4991bddd87",
"name": "JotForm触发器",
"type": "n8n-nodes-base.jotFormTrigger",
"position": [
-1488,
256
],
"webhookId": "209c111c-5573-466c-8602-b4d6e2f44659",
"parameters": {
"form": "252815253377461"
},
"credentials": {
"jotFormApi": {
"id": "cOSh16Q5l4e0EB1A",
"name": "Jotform jitesh@mediajade.com"
}
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "6b6c692c-9156-400b-938a-66f0ae41f11c",
"connections": {
"Send a message": {
"main": [
[
{
"node": "Request Fraud Investigation",
"type": "main",
"index": 0
}
]
]
},
"Amount > $5000?": {
"main": [
[
{
"node": "Request Manager Approval",
"type": "main",
"index": 0
}
],
[
{
"node": "Update an invoice",
"type": "main",
"index": 0
}
]
]
},
"JotForm Trigger": {
"main": [
[
{
"node": "Has Invoice Attachment?",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Fraud Detection Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Update an invoice": {
"main": [
[
{
"node": "Notify Vendor - Approved",
"type": "main",
"index": 0
}
]
]
},
"Parse Invoice Data": {
"main": [
[
{
"node": "AI Fraud Detection Agent",
"type": "main",
"index": 0
}
]
]
},
"Critical Fraud Risk?": {
"main": [
[
{
"node": "Send a message",
"type": "main",
"index": 0
}
],
[
{
"node": "Amount > $5000?",
"type": "main",
"index": 0
}
]
]
},
"Auto-Approve Eligible?": {
"main": [
[
{
"node": "Update an invoice",
"type": "main",
"index": 0
}
],
[
{
"node": "Amount > $5000?",
"type": "main",
"index": 0
}
]
]
},
"Has Invoice Attachment?": {
"main": [
[
{
"node": "Extract Invoice Attachments",
"type": "main",
"index": 0
}
]
]
},
"AI Fraud Detection Agent": {
"main": [
[
{
"node": "Critical Fraud Risk?",
"type": "main",
"index": 0
},
{
"node": "Auto-Approve Eligible?",
"type": "main",
"index": 0
}
]
]
},
"Notify Vendor - Approved": {
"main": [
[
{
"node": "Log to Invoice Database",
"type": "main",
"index": 0
}
]
]
},
"Request Manager Approval": {
"main": [
[
{
"node": "Log to Invoice Database",
"type": "main",
"index": 0
}
]
]
},
"Structured Output Parser": {
"ai_outputParser": [
[
{
"node": "AI Fraud Detection Agent",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"AI Invoice OCR & Extraction": {
"main": [
[
{
"node": "Parse Invoice Data",
"type": "main",
"index": 0
}
]
]
},
"Extract Invoice Attachments": {
"main": [
[
{
"node": "AI Invoice OCR & Extraction",
"type": "main",
"index": 0
}
]
]
},
"Request Fraud Investigation": {
"main": [
[
{
"node": "Log to Invoice Database",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
AI 驱动的招聘:使用 Jotform 进行简历筛选和候选人路由
简历筛选与候选人路由,使用GPT-4o-mini、Jotform和Google Sheets
If
Set
Code
+10
20 节点Jitesh Dugar
AI招生审核:论文分析、综合评分与候选人排名
GPT-4o驱动的招生审核:论文分析、综合评分与候选人排名
If
Set
Gmail
+8
22 节点Jitesh Dugar
使用 OpenAI 进行潜在客户分析与个性化邮件生成
使用 Jotform、GPT 和 Gmail 自动进行潜在客户资格认定与个性化触达
If
Code
Gmail
+7
16 节点Jitesh Dugar
AI医疗分诊:智能分诊、医生简报和紧急情况检测
基于GPT-4和JotForm的医疗分诊与预约自动化
If
Set
Code
+8
22 节点Jitesh Dugar
基于AI的客户入职流程(JotForm、Asana、Slack和HubSpot)
基于AI的客户入职流程(JotForm、Asana、Slack和HubSpot)
Code
Asana
Gmail
+7
21 节点Jitesh Dugar
使用 GPT-4 分析和 JotForm 离职面谈自动化员工离职流程
使用 GPT-4 分析和 JotForm 离职面谈实现员工离职流程自动化
If
Set
Code
+6
20 节点Jitesh Dugar
工作流信息
难度等级
高级
节点数量22
分类-
节点类型12
作者
Jitesh Dugar
@jiteshdugarAI Automation Specialist - OpenAI, CRM & Automation Expert with a solid understanding of various tools that include Zapier, Make, Zoho CRM, Hubspot, Google Sheets, Airtable, Pipedrive, Google Analytics, and more.
外部链接
在 n8n.io 查看 →
分享此工作流