{ "name": "Draft replies to emails you forward to an AI agent with Pidgeon", "nodes": [ { "id": "6f0c1d2e-0001-4a00-8000-000000000001", "name": "About this workflow", "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, "position": [-760, -360], "parameters": { "width": 520, "height": 760, "content": "## Draft replies to emails you forward to an AI agent\n\n**Self-hosted n8n only** until the Pidgeon node is verified: it is a community node, `@pidgeon-ai/n8n-nodes-pidgeon`.\n\n### Who it is for\nAnybody who wants a model to draft answers without giving it their inbox.\n\n### How it works\nYou forward one email to your agent's own Pidgeon address. The workflow checks the forward came from you, signed and clean, and a model drafts an answer in your style. The draft comes back to you as a reply, threaded under what you sent. You edit it and send it from your own address. The model only ever sees the one email you forwarded.\n\n### How to set up\n1. In Pidgeon, create an address for the agent (type agent, *only people who wrote first*).\n2. Make a key with **send** on that one address. Add it as a Pidgeon API credential.\n3. Pick the address in the trigger, and put your own addresses and three of your sent emails in **Your settings**.\n4. Add your Anthropic credential, or swap the model for another.\n\n### Requirements\nA Pidgeon account, an n8n instance on a public HTTPS URL, and a model credential.\n\n### How to customise\nForward is for \"answer this\". To have the agent answer the original sender itself, replace the last node with **Pidgeon → Save a draft** to `{{ $json.from }}`, which needs an address that may write to anybody.\n\nSetup and the other templates: https://pidgeon.ai/docs/n8n?utm_source=n8n" } }, { "id": "6f0c1d2e-0001-4a00-8000-000000000002", "name": "When you forward an email", "type": "@pidgeon-ai/n8n-nodes-pidgeon.pidgeonTrigger", "typeVersion": 1, "position": [-160, 0], "webhookId": "6f0c1d2e-0001-4a00-8000-0000000000a1", "parameters": { "event": "messageReceived", "address": "", "fetchMessage": true, "body": "original" } }, { "id": "6f0c1d2e-0001-4a00-8000-000000000003", "name": "Your settings", "type": "n8n-nodes-base.set", "typeVersion": 3.4, "position": [60, 0], "parameters": { "assignments": { "assignments": [ { "id": "your-addresses", "name": "your_addresses", "value": "you@yourcompany.com, you@gmail.com", "type": "string" }, { "id": "style-sample", "name": "style_sample", "value": "Paste three emails you have sent here, so the draft sounds like you.", "type": "string" } ] }, "includeOtherFields": true, "options": {} } }, { "id": "6f0c1d2e-0001-4a00-8000-000000000004", "name": "From you, signed and clean", "type": "n8n-nodes-base.if", "typeVersion": 2.2, "position": [280, 0], "parameters": { "conditions": { "options": { "caseSensitive": true, "leftValue": "", "typeValidation": "strict", "version": 2 }, "conditions": [ { "id": "from-you", "leftValue": "={{ $json.your_addresses.toLowerCase().split(',').map(a => a.trim()).includes($json.from) }}", "rightValue": "", "operator": { "type": "boolean", "operation": "true", "singleValue": true } }, { "id": "dmarc-pass", "leftValue": "={{ $json.auth_dmarc }}", "rightValue": "pass", "operator": { "type": "string", "operation": "equals" } }, { "id": "firewall-clean", "leftValue": "={{ $json.firewall_verdict }}", "rightValue": "clean", "operator": { "type": "string", "operation": "equals" } } ], "combinator": "and" }, "options": {} } }, { "id": "6f0c1d2e-0001-4a00-8000-000000000005", "name": "Draft the answer", "type": "@n8n/n8n-nodes-langchain.chainLlm", "typeVersion": 1.7, "position": [520, -100], "parameters": { "promptType": "define", "text": "=Somebody forwarded you an email and wants an answer they can send. Write only the answer: no subject line, no preamble, no notes to them. Match the tone and length of their own emails below. If the email asks for something you cannot know, leave a short [bracketed] gap for them to fill.\n\nTheir own emails, for style:\n{{ $json.style_sample }}\n\nWhat they forwarded, with their note on top:\n{{ $json.text }}" } }, { "id": "6f0c1d2e-0001-4a00-8000-000000000006", "name": "Claude", "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic", "typeVersion": 1.3, "position": [520, 120], "parameters": { "model": { "__rl": true, "mode": "list", "value": "claude-sonnet-5-5" }, "options": {} } }, { "id": "6f0c1d2e-0001-4a00-8000-000000000007", "name": "Send the draft back to you", "type": "@pidgeon-ai/n8n-nodes-pidgeon.pidgeon", "typeVersion": 1, "position": [840, -100], "parameters": { "resource": "message", "operation": "reply", "messageId": "={{ $('When you forward an email').item.json.message_id }}", "text": "={{ $json.text }}", "additionalFields": {} } } ], "connections": { "When you forward an email": { "main": [[{ "node": "Your settings", "type": "main", "index": 0 }]] }, "Your settings": { "main": [[{ "node": "From you, signed and clean", "type": "main", "index": 0 }]] }, "From you, signed and clean": { "main": [[{ "node": "Draft the answer", "type": "main", "index": 0 }], []] }, "Claude": { "ai_languageModel": [[{ "node": "Draft the answer", "type": "ai_languageModel", "index": 0 }]] }, "Draft the answer": { "main": [[{ "node": "Send the draft back to you", "type": "main", "index": 0 }]] } }, "settings": { "executionOrder": "v1" }, "pinData": {} }