{ "name": "AI Email Classification with Verifiable Decision Receipts", "nodes": [ { "parameters": { "pollTimes": { "item": [ { "mode": "everyMinute" } ] }, "simple": true, "filters": {} }, "id": "6d47370e-c573-4446-80f6-e95b0d6a0696", "name": "Gmail Trigger", "type": "n8n-nodes-base.gmailTrigger", "typeVersion": 1.2, "position": [ 0, 300 ], "credentials": { "gmailOAuth2": { "id": "REPLACE_GMAIL_CRED_ID", "name": "Gmail account" } } }, { "parameters": { "modelId": { "__rl": true, "mode": "list", "value": "gpt-4o", "cachedResultName": "GPT-4O" }, "messages": { "values": [ { "role": "system", "content": "=You are an email triage AI. Classify the email and return JSON: {\"category\":\"SPAM|SUPPORT|SALES|OTHER\",\"is_spam\":true,\"reason\":\"...\"}." }, { "content": "=Classify this email. JSON only.\n\nFrom: {{ $json.from }}\nSubject: {{ $json.subject }}\nBody:\n{{ $json.snippet }}" } ] }, "jsonOutput": true, "options": {} }, "id": "b8aa05ce-d3be-4037-aee0-88566bc84244", "name": "AI Email Classification", "type": "@n8n/n8n-nodes-langchain.openAi", "typeVersion": 2.1, "position": [ 220, 300 ], "credentials": { "openAiApi": { "id": "REPLACE_OPENAI_CRED_ID", "name": "OpenAi account" } } }, { "parameters": { "operation": "generateReceipt", "agentName": "EmailTriageAgent", "workflowName": "={{ $workflow.name }}", "action": "={{ 'Classified email as ' + $json.message.content.category }}", "decision": "={{ JSON.stringify($json.message.content) }}", "additionalFields": { "modelProvider": "openai", "modelUsed": "gpt-4o-mini", "decisionType": "classification", "riskLevel": "low", "humanReview": false, "policies": "data-handling-v1", "permissions": "email.classify", "tags": "email, triage, automation" } }, "id": "88d06852-2438-49b1-8165-55893b621818", "name": "Signatrust: Receipt", "type": "n8n-nodes-signatrust.signatrust", "typeVersion": 1, "position": [ 440, 300 ], "credentials": { "signatrustApi": { "id": "REPLACE_SIGNATRUST_CRED_ID", "name": "Signatrust API account" } } }, { "parameters": { "conditions": { "options": { "caseSensitive": true, "leftValue": "", "typeValidation": "loose" }, "conditions": [ { "id": "73dcb603-bbca-4267-914e-2502e483dfbe", "leftValue": "={{ $('AI Email Classification').item.json.message.content.is_spam }}", "rightValue": "true", "operator": { "type": "boolean", "operation": "true" } } ], "combinator": "and" }, "options": {} }, "id": "7ff07fef-bb58-4d6b-9a0c-fab6daf2be2c", "name": "IF Spam", "type": "n8n-nodes-base.if", "typeVersion": 2.2, "position": [ 660, 300 ] }, { "parameters": { "operation": "addLabels", "messageId": "={{ $('Gmail Trigger').item.json.id }}", "labelIds": [ "SPAM" ] }, "id": "aeded956-873d-4b48-85ff-b9e11ca8a6b7", "name": "Move to Spam", "type": "n8n-nodes-base.gmail", "typeVersion": 2.1, "position": [ 880, 200 ], "credentials": { "gmailOAuth2": { "id": "REPLACE_GMAIL_CRED_ID", "name": "Gmail account" } } }, { "parameters": {}, "id": "7afb7823-a4cc-4f6d-870d-7c5d337c69fc", "name": "Keep in Inbox", "type": "n8n-nodes-base.noOp", "typeVersion": 1, "position": [ 880, 440 ] }, { "parameters": { "content": "## AI Email Classification + Signatrust\nEvery automated email classification is signed so that if a message is later disputed (e.g. wrongly marked spam) you have a verifiable record of the AI's decision.", "height": 200, "width": 430, "color": 5 }, "id": "940e6c75-1e20-44b4-bfb0-3b87cf61dd17", "name": "Sticky Note 48fe7c", "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, "position": [ -40, 30 ] } ], "connections": { "Gmail Trigger": { "main": [ [ { "node": "AI Email Classification", "type": "main", "index": 0 } ] ] }, "AI Email Classification": { "main": [ [ { "node": "Signatrust: Receipt", "type": "main", "index": 0 } ] ] }, "Signatrust: Receipt": { "main": [ [ { "node": "IF Spam", "type": "main", "index": 0 } ] ] }, "IF Spam": { "main": [ [ { "node": "Move to Spam", "type": "main", "index": 0 } ], [ { "node": "Keep in Inbox", "type": "main", "index": 0 } ] ] } }, "active": false, "pinData": {}, "settings": { "executionOrder": "v1" }, "tags": [ { "name": "AI Email Classification — Email" }, { "name": "AI Email Classification — Triage" }, { "name": "Signatrust (5)" }, { "name": "AI Email Classification — AI" } ], "meta": { "templateCredsSetupCompleted": false }, "versionId": "8d9f7dc8-37cd-4f3e-879d-acfd38f176d2" }