{ "name": "Invoice Approval with Verifiable Decision Receipts", "nodes": [ { "parameters": { "httpMethod": "POST", "path": "invoice-approval", "options": {}, "responseMode": "responseNode" }, "id": "14831c8e-ba43-4d8d-ac1c-5b44042eac43", "name": "New Invoice", "type": "n8n-nodes-base.webhook", "typeVersion": 2.1, "position": [ 0, 300 ], "webhookId": "c412784f-fe4d-445d-a75e-59c27419f550" }, { "parameters": { "modelId": { "__rl": true, "mode": "list", "value": "gpt-4o", "cachedResultName": "GPT-4O" }, "messages": { "values": [ { "role": "system", "content": "=You are an accounts-payable AI agent. Analyze the invoice and decide APPROVE or HOLD. Return JSON: {\"decision\":\"APPROVE|HOLD\",\"reason\":\"...\",\"amount\":0,\"vendor\":\"...\"}." }, { "content": "=Analyze this invoice and return JSON only.\n\nInvoice:\n{{ JSON.stringify($json.body) }}" } ] }, "jsonOutput": true, "options": {} }, "id": "539ff727-7804-476f-8603-90cf9332c1a1", "name": "AI Invoice Analysis", "type": "@n8n/n8n-nodes-langchain.openAi", "typeVersion": 2.1, "position": [ 220, 300 ], "credentials": { "openAiApi": { "id": "REPLACE_OPENAI_CRED_ID", "name": "OpenAi account" } } }, { "parameters": { "conditions": { "options": { "caseSensitive": true, "leftValue": "", "typeValidation": "loose" }, "conditions": [ { "id": "5fe897bd-603f-4fe0-bd58-4cedfba9d4e0", "leftValue": "={{ $json.message.content.decision }}", "rightValue": "APPROVE", "operator": { "type": "string", "operation": "equals" } } ], "combinator": "and" }, "options": {} }, "id": "f1aea1f2-36c9-4a4c-9d34-7f75ded77c5e", "name": "IF Approved", "type": "n8n-nodes-base.if", "typeVersion": 2.2, "position": [ 440, 300 ] }, { "parameters": { "operation": "generateReceipt", "agentName": "InvoiceApprovalAgent", "workflowName": "={{ $workflow.name }}", "action": "={{ 'Invoice ' + $json.message.content.decision }}", "decision": "={{ JSON.stringify($json.message.content) }}", "additionalFields": { "modelProvider": "openai", "modelUsed": "gpt-4o", "decisionType": "invoice_approval", "riskLevel": "medium", "humanReview": false, "policies": "ap-controls-v2, sox-segregation", "permissions": "invoice.approve, payment.schedule", "tags": "finance, invoice, ap" } }, "id": "2d20ec38-98f0-49b7-931a-73c110b17bde", "name": "Signatrust: Receipt", "type": "n8n-nodes-signatrust.signatrust", "typeVersion": 1, "position": [ 660, 200 ], "credentials": { "signatrustApi": { "id": "REPLACE_SIGNATRUST_CRED_ID", "name": "Signatrust API account" } } }, { "parameters": { "method": "POST", "url": "https://httpbin.org/post", "options": {}, "sendBody": true, "bodyParameters": { "parameters": [ { "name": "invoice", "value": "={{ $('New Invoice').item.json.body }}" }, { "name": "receipt_id", "value": "={{ $json.id }}" } ] } }, "id": "3b3ed7f4-52ad-49d9-91c9-dc4b1e1f082d", "name": "Post to ERP", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 880, 200 ] }, { "parameters": { "respondWith": "json", "responseBody": "={{ { \"status\": \"HOLD\", \"detail\": $('AI Invoice Analysis').item.json.message.content } }}", "options": {} }, "id": "7e90dc36-a939-41ac-92b0-ca2986323fe8", "name": "Respond Hold", "type": "n8n-nodes-base.respondToWebhook", "typeVersion": 1.1, "position": [ 660, 440 ] }, { "parameters": { "content": "## Invoice Approval + Signatrust\nAI reviews each invoice and approves or holds it. The approval is signed into a Decision Receipt that proves **why** it was approved, **when**, and **by which agent** — ready for SOX/audit.", "height": 200, "width": 420, "color": 5 }, "id": "a06fa2a4-754f-4f72-806c-7eba5d283b28", "name": "Sticky Note 782fd8", "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, "position": [ -40, 30 ] } ], "connections": { "New Invoice": { "main": [ [ { "node": "AI Invoice Analysis", "type": "main", "index": 0 } ] ] }, "AI Invoice Analysis": { "main": [ [ { "node": "IF Approved", "type": "main", "index": 0 } ] ] }, "IF Approved": { "main": [ [ { "node": "Signatrust: Receipt", "type": "main", "index": 0 } ], [ { "node": "Respond Hold", "type": "main", "index": 0 } ] ] }, "Signatrust: Receipt": { "main": [ [ { "node": "Post to ERP", "type": "main", "index": 0 } ] ] } }, "active": false, "pinData": {}, "settings": { "executionOrder": "v1" }, "tags": [ { "name": "Invoice Approval — Finance" }, { "name": "Invoice Approval — Invoice" }, { "name": "Signatrust (2)" }, { "name": "Invoice Approval — AI" } ], "meta": { "templateCredsSetupCompleted": false }, "versionId": "cb75b480-186d-4973-a86e-df2d9eeb656f" }