This workflow corresponds to n8n.io template #10583 — we link there as the canonical source.
This workflow follows the Agent → OpenAI Chat 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 →
{
"id": "Yn7tmZK650FOKDSc",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "AI-Powered Email Classification and Auto-Reply System",
"tags": [],
"nodes": [
{
"id": "c1f2aa2b-570c-4d6b-b0c8-13f9cea4bbf7",
"name": "Microsoft Outlook Trigger",
"type": "n8n-nodes-base.microsoftOutlookTrigger",
"position": [
-432,
976
],
"parameters": {
"filters": {},
"options": {
"downloadAttachments": true
},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
}
},
"typeVersion": 1
},
{
"id": "e3dfd5b1-89cd-41de-9d4a-4d020258de7b",
"name": "OpenAI Chat Model - Classifier",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
-16,
1104
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini"
},
"options": {}
},
"typeVersion": 1.2
},
{
"id": "6b25f516-0620-4202-95ea-af50d7b3ab43",
"name": "Reply to Urgent Email",
"type": "n8n-nodes-base.microsoftOutlook",
"position": [
1056,
288
],
"parameters": {
"message": "={{ $json.output }}",
"options": {},
"messageId": {
"__rl": true,
"mode": "id",
"value": "={{ $('Microsoft Outlook Trigger').item.json.id }}"
},
"operation": "reply",
"additionalFields": {
"replyTo": "={{ $('Microsoft Outlook Trigger').item.json.from }}"
},
"replyToSenderOnly": true
},
"typeVersion": 2
},
{
"id": "e4c42889-28d6-4308-ac59-965972450ef9",
"name": "AI Email Classifier",
"type": "@n8n/n8n-nodes-langchain.textClassifier",
"position": [
48,
944
],
"parameters": {
"options": {
"systemPromptTemplate": "=# Role\nYou are an expert in email classification based on importance and urgency.\n\n# Context\nYou will receive email bodies that you will analyze to classify them into a specific category.\n\nYou have three categories available:\n\n1/ Urgent\n\n2/ Important\n\n3/ Not Important\n\n# Instructions\n\nTo perfectly define the right category for each email, here are some guidelines:\n\n1/ \"Urgent\" Category:\nClassify all emails where there is a stated urgency, an important deadline approaching in the short term, where case management is a priority, and where the information, request, or inquiry is genuinely urgent.\n\n2/ \"Important\" Category:\nClassify all emails where the request, action to be taken, or case/client processing remains important without being an absolute emergency and where the deadline is short to medium term. This is a somewhat tricky category because the line between \"Urgent\" and \"Important\" can quickly become blurred depending on the words used. Pay close attention to correctly discern and precisely judge whether the email corresponds to an emergency or whether it simply remains an \"Important\" email without needing to rush to process it.\n\n3/ \"Not Important\" Category:\nClassify all emails where the importance is much lower than the other types of emails described in the other categories. These are still professional emails but they target a more distant deadline, are not important for this week, do not deal with an important case/client, or are slightly more secondary.\n\n# Important Information\n\nToday's date: {{ $today }}"
},
"inputText": "={{ $json.bodyPreview }}",
"categories": {
"categories": [
{
"category": "Urgent",
"description": "Emails that are urgent and require immediate attention"
},
{
"category": "Important",
"description": "Emails that are important but not urgent"
},
{
"category": "Not Important",
"description": "Emails that are neither important nor urgent"
}
]
}
},
"typeVersion": 1.1
},
{
"id": "107fdc73-595c-4f16-969a-3fadcbb62441",
"name": "Generate Urgent Reply",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
624,
272
],
"parameters": {
"text": "=Reply to this email:\n{{ $('Microsoft Outlook Trigger').item.json.bodyPreview }}",
"options": {
"systemMessage": "=# Role\nYou are an expert in writing email replies.\n\n# Instructions\n\nYou write in the first person.\n\nYou write briefly and precisely.\n\nYou are polite and use formal language with the person who sent the email.\n\nYou indicate that the file, question, or subject will be processed quickly given its importance (close date, meeting request, importance of a case, etc.).\n\nYou don't always write the same email. The response must seem human and natural.\n\nYou always end your email with polite closing formulas (e.g., \"Best regards\", \"Kind regards\", \"Sincerely\", etc.).\n\n# Important Information\n\nToday's date: {{ $today }}"
},
"promptType": "define"
},
"typeVersion": 2.2
},
{
"id": "ab884171-cf1f-446b-a22d-7af727d525d1",
"name": "OpenAI Chat Model - Urgent",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
560,
432
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini"
},
"options": {}
},
"typeVersion": 1.2
},
{
"id": "5d106834-c16c-44da-9dad-c2823475bad1",
"name": "Reply to Important Email",
"type": "n8n-nodes-base.microsoftOutlook",
"position": [
1040,
912
],
"parameters": {
"message": "={{ $json.output }}",
"options": {},
"messageId": {
"__rl": true,
"mode": "id",
"value": "={{ $('Microsoft Outlook Trigger').item.json.id }}"
},
"operation": "reply",
"additionalFields": {
"replyTo": "={{ $('Microsoft Outlook Trigger').item.json.from }}"
},
"replyToSenderOnly": true
},
"typeVersion": 2
},
{
"id": "744080bc-1296-4c1e-a0aa-3bd6aed8db0f",
"name": "Generate Important Reply",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
640,
880
],
"parameters": {
"text": "=Write the reply email for this message:\n\n{{ $item(\"0\").$node[\"Microsoft Outlook Trigger\"].json[\"bodyPreview\"] }}",
"options": {
"systemMessage": "=# Role\nYou are an expert in writing email replies.\n\nThe email is transmitted to you in the user prompt.\n\n# Instructions\n\nYou write in the first person.\n\nYou write briefly and precisely.\n\nYou are polite and use formal language with the person who sent the email.\n\nYou indicate that the file, question, or subject will be processed without showing that it's urgent or indicating that it's being put on the back burner or will be processed later.\n\nYou don't always write the same email. The response must seem human and natural.\n\nYou always end your email with polite closing formulas (e.g., \"Best regards\", \"Kind regards\", \"Sincerely\", etc.).\n\n# Important Information\n\nToday's date: {{ $today }}"
},
"promptType": "define"
},
"typeVersion": 2.2
},
{
"id": "36c2d4b3-9934-4352-a945-5a545ee94e89",
"name": "OpenAI Chat Model - Important",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
496,
1008
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini"
},
"options": {}
},
"typeVersion": 1.2
},
{
"id": "227f3b68-24b8-49ac-a4c5-5df5583ffb3c",
"name": "Move to Not Important Folder",
"type": "n8n-nodes-base.microsoftOutlook",
"position": [
1504,
1344
],
"parameters": {
"folderId": {
"__rl": true,
"mode": "list",
"value": "AQMkADAwATM0MDAAMi05OQA0Ni0wMAA2MS0wMAItMDAKAC4AAAO1-Epgjxr1TaaZjmLt5cKwAQBFZJ1Tub2VQKCvIGXV0RM_AAAADQXuOQAAAA==",
"cachedResultUrl": "https://outlook.office365.com/mail/AQMkADAwATM0MDAAMi05OQA0Ni0wMAA2MS0wMAItMDAKAC4AAAO1%2FEpgjxr1TaaZjmLt5cKwAQBFZJ1Tub2VQKCvIGXV0RM_AAAADQXuOQAAAA%3D%3D",
"cachedResultName": "Not Important"
},
"messageId": {
"__rl": true,
"mode": "id",
"value": "={{ $json.id }}"
},
"operation": "move"
},
"typeVersion": 2
},
{
"id": "611de7c4-4b54-454a-a7f4-8a1c045d42ed",
"name": "Reply to Not Important Email",
"type": "n8n-nodes-base.microsoftOutlook",
"position": [
1088,
1456
],
"parameters": {
"message": "={{ $json.output }}",
"options": {},
"messageId": {
"__rl": true,
"mode": "id",
"value": "={{ $('Microsoft Outlook Trigger').item.json.id }}"
},
"operation": "reply",
"additionalFields": {
"replyTo": "={{ $('Microsoft Outlook Trigger').item.json.from }}"
},
"replyToSenderOnly": true
},
"typeVersion": 2
},
{
"id": "b9328e8e-75f9-479e-9008-fce7f7edfdff",
"name": "Generate Standard Reply",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
672,
1488
],
"parameters": {
"text": "=Write the reply to this email:\n{{ $item(\"0\").$node[\"Microsoft Outlook Trigger\"].json[\"bodyPreview\"] }}",
"options": {
"systemMessage": "=# Role\nYou are an expert in writing email replies.\n\nThe email is transmitted to you in the user prompt.\n\n# Instructions\n\nYou write in the first person.\n\nYou write briefly and precisely.\n\nYou are polite and use formal language with the person who sent the email.\n\nYou indicate that the file, question, or subject will be processed within a relatively short timeframe.\n\nYou never specify that the subject/file/etc. is not important.\n\nYou make it clear that everything will be processed in due time.\n\nYou don't always write the same email. The response must seem human and natural.\n\nYou always end your email with polite closing formulas (e.g., \"Best regards\", \"Kind regards\", \"Sincerely\", etc.).\n\n# Important Information\n\nToday's date: {{ $today }}"
},
"promptType": "define"
},
"typeVersion": 2.2
},
{
"id": "7f5ecf8b-f7f2-454e-9c87-9735eec112a1",
"name": "OpenAI Chat Model - Standard",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
480,
1584
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini"
},
"options": {}
},
"typeVersion": 1.2
},
{
"id": "5231d92d-d9c2-4fbc-a10b-4080a9343c9d",
"name": "Move to Urgent Folder",
"type": "n8n-nodes-base.microsoftOutlook",
"position": [
1552,
400
],
"parameters": {
"folderId": {
"__rl": true,
"mode": "list",
"value": "AQMkADAwATM0MDAAMi05OQA0Ni0wMAA2MS0wMAItMDAKAC4AAAO1-Epgjxr1TaaZjmLt5cKwAQBFZJ1Tub2VQKCvIGXV0RM_AAAADQXuNwAAAA==",
"cachedResultUrl": "https://outlook.office365.com/mail/AQMkADAwATM0MDAAMi05OQA0Ni0wMAA2MS0wMAItMDAKAC4AAAO1%2FEpgjxr1TaaZjmLt5cKwAQBFZJ1Tub2VQKCvIGXV0RM_AAAADQXuNwAAAA%3D%3D",
"cachedResultName": "URGENT"
},
"messageId": {
"__rl": true,
"mode": "id",
"value": "={{ $('AI Email Classifier').item.json.id }}"
},
"operation": "move"
},
"typeVersion": 2
},
{
"id": "b944ef3f-560f-4745-8583-573914a8df1e",
"name": "Move to Important Folder",
"type": "n8n-nodes-base.microsoftOutlook",
"position": [
1536,
880
],
"parameters": {
"folderId": {
"__rl": true,
"mode": "list",
"value": "AQMkADAwATM0MDAAMi05OQA0Ni0wMAA2MS0wMAItMDAKAC4AAAO1-Epgjxr1TaaZjmLt5cKwAQBFZJ1Tub2VQKCvIGXV0RM_AAAADQXuOAAAAA==",
"cachedResultUrl": "https://outlook.office365.com/mail/AQMkADAwATM0MDAAMi05OQA0Ni0wMAA2MS0wMAItMDAKAC4AAAO1%2FEpgjxr1TaaZjmLt5cKwAQBFZJ1Tub2VQKCvIGXV0RM_AAAADQXuOAAAAA%3D%3D",
"cachedResultName": "Important"
},
"messageId": {
"__rl": true,
"mode": "id",
"value": "={{ $('AI Email Classifier').item.json.id }}"
},
"operation": "move"
},
"typeVersion": 2
},
{
"id": "8ecd8b0b-91e1-4e5a-9647-537eb08d6506",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1216,
240
],
"parameters": {
"width": 480,
"height": 780,
"content": "## AI-Powered Email Classification and Auto-Reply System\n\n### Who's it for\nProfessionals and teams managing high email volumes who need automatic email triage and responses.\n\n### What it does\nThis workflow monitors your Outlook inbox and uses AI to classify emails into three urgency levels: Urgent, Important, or Not Important. It automatically generates personalized replies and organizes emails into folders.\n\n### How it works\nNew emails trigger AI classification based on urgency and deadlines. The system then generates an appropriate reply using GPT-4 and moves the email to the corresponding folder.\n\n### Requirements\n- Microsoft Outlook account with API access\n- OpenAI API key (GPT-4 access)\n- Three Outlook folders: URGENT, Important, Not Important\n\n### Setup\nConnect your Outlook credentials, add your OpenAI API key to all Chat Model nodes, update folder IDs in the Move nodes, and customize the AI prompts to match your tone.\n\n### Customization\nAdjust classification criteria, modify reply tone and style, add more categories, or integrate with other tools like Slack or CRM systems."
},
"typeVersion": 1
},
{
"id": "217734d2-91cc-4041-87ac-0602b251b5be",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-576,
528
],
"parameters": {
"color": 7,
"width": 380,
"height": 768,
"content": "## 1. Email Trigger\n\nMonitors your Microsoft Outlook inbox and checks for new emails every minute. Automatically downloads attachments and captures all email metadata.\n\n**Configuration:**\n- Poll frequency: Every minute\n- Filters: None (processes all emails)\n- Attachments: Enabled\n\nEmail data flows to the AI classifier for analysis."
},
"typeVersion": 1
},
{
"id": "70d4589a-7e80-471b-95b9-95947667231e",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-64,
528
],
"parameters": {
"color": 7,
"width": 420,
"height": 772,
"content": "## 2. AI Email Classification\n\nAnalyzes email content and classifies into three categories based on urgency, deadlines, and importance.\n\n**Categories:**\n- **Urgent:** Immediate attention, close deadlines\n- **Important:** Needs attention, not time-sensitive\n- **Not Important:** Standard correspondence\n\nUses GPT-4 mini for fast classification. Considers today's date for deadline calculations and looks for urgency indicators like deadline language, client importance, and time-sensitive items.\n\nRoutes to appropriate reply generation based on classification."
},
"typeVersion": 1
},
{
"id": "c95221f7-d0cd-43ff-9e21-de799663b9ff",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
448,
-16
],
"parameters": {
"color": 7,
"width": 804,
"height": 552,
"content": "## 3A. Urgent Email Path\n\nGenerates immediate acknowledgment with urgent tone, emphasizing quick response commitment. References specific deadlines while maintaining natural variation.\n\n**Reply style:**\n- First person, brief and direct\n- Formal language\n- Commits to rapid processing\n\nAutomatically sends reply to sender and moves email to URGENT folder for priority follow-up."
},
"typeVersion": 1
},
{
"id": "91c7df05-e1c1-4a9e-a5c6-d2f6880ecd69",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
448,
592
],
"parameters": {
"color": 7,
"width": 804,
"height": 536,
"content": "## 3B. Important Email Path\n\nCreates balanced acknowledgment indicating timely processing without rushed language. Professional and measured tone.\n\n**Reply style:**\n- First person, concise yet complete\n- Formal language\n- Neutral timeline commitment\n\nSends reply automatically and moves email to Important folder for standard follow-up."
},
"typeVersion": 1
},
{
"id": "f69cb8b1-a631-47ce-92bb-8bfce1a560dc",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
448,
1184
],
"parameters": {
"color": 7,
"width": 804,
"height": 528,
"content": "## 3C. Not Important Email Path\n\nGenerates courteous acknowledgment with reasonable timeline expectations. Never implies low priority explicitly while maintaining professionalism.\n\n**Reply style:**\n- First person, brief and polite\n- Formal language\n- \"In due time\" messaging\n\nSends reply automatically and moves email to Not Important folder for later review."
},
"typeVersion": 1
},
{
"id": "00dd4800-5592-4a09-ad18-a0aecb174232",
"name": "Sticky Note6",
"type": "n8n-nodes-base.stickyNote",
"position": [
1344,
-16
],
"parameters": {
"color": 7,
"width": 472,
"height": 1736,
"content": "## 4. Email Organization\n\nMoves each processed email to its designated folder based on classification.\n\n**Folder routing:**\n- Urgent \u2192 URGENT folder\n- Important \u2192 Important folder\n- Not Important \u2192 Not Important folder\n\nProvides clean inbox, easy priority identification, and efficient email management.\n\n**Setup required:** Create these three folders in Outlook before running the workflow."
},
"typeVersion": 1
},
{
"id": "17cbe272-f507-4f06-b33d-25bebd644efc",
"name": "Sticky Note7",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1168,
1088
],
"parameters": {
"color": 5,
"width": 360,
"height": 240,
"content": "## \u26a0\ufe0f Important Configuration Notes\n\n**Before running:**\n- Update OpenAI API credentials\n- Configure Microsoft Outlook connection\n- Create three folders: URGENT, Important, Not Important\n- Update folder IDs in Move nodes\n\n**Security:** Never hardcode API keys, use n8n credential system.\n\n**Testing:** Start with sample emails to verify folder routing and reply quality."
},
"typeVersion": 1
},
{
"id": "8d384320-be21-4688-a7d4-b16c97408ebc",
"name": "Sticky Note8",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1168,
1424
],
"parameters": {
"color": 6,
"width": 360,
"height": 200,
"content": "## \ud83d\udca1 Customization Tips\n\n**Adjust classification:**\nEdit criteria in AI Email Classifier prompt, add more categories, or fine-tune urgency detection.\n\n**Personalize replies:**\nModify tone in each AI Agent's system message, add company-specific language, or include signature templates.\n\n**Extend functionality:**\nAdd Slack notifications for urgent emails, integrate with CRM systems, or create custom reporting dashboards."
},
"typeVersion": 1
}
],
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "af094ceb-635c-4965-aaae-ad2459ce9bfc",
"connections": {
"AI Email Classifier": {
"main": [
[
{
"node": "Generate Urgent Reply",
"type": "main",
"index": 0
}
],
[
{
"node": "Generate Important Reply",
"type": "main",
"index": 0
}
],
[
{
"node": "Generate Standard Reply",
"type": "main",
"index": 0
}
]
]
},
"Generate Urgent Reply": {
"main": [
[
{
"node": "Reply to Urgent Email",
"type": "main",
"index": 0
}
]
]
},
"Reply to Urgent Email": {
"main": [
[
{
"node": "Move to Urgent Folder",
"type": "main",
"index": 0
}
]
]
},
"Generate Standard Reply": {
"main": [
[
{
"node": "Reply to Not Important Email",
"type": "main",
"index": 0
}
]
]
},
"Generate Important Reply": {
"main": [
[
{
"node": "Reply to Important Email",
"type": "main",
"index": 0
}
]
]
},
"Reply to Important Email": {
"main": [
[
{
"node": "Move to Important Folder",
"type": "main",
"index": 0
}
]
]
},
"Microsoft Outlook Trigger": {
"main": [
[
{
"node": "AI Email Classifier",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model - Urgent": {
"ai_languageModel": [
[
{
"node": "Generate Urgent Reply",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"OpenAI Chat Model - Standard": {
"ai_languageModel": [
[
{
"node": "Generate Standard Reply",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Reply to Not Important Email": {
"main": [
[
{
"node": "Move to Not Important Folder",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model - Important": {
"ai_languageModel": [
[
{
"node": "Generate Important Reply",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"OpenAI Chat Model - Classifier": {
"ai_languageModel": [
[
{
"node": "AI Email Classifier",
"type": "ai_languageModel",
"index": 0
}
]
]
}
}
}
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Who's it for Professionals and teams managing high email volumes who need automatic email triage and responses. What it does This workflow monitors your Outlook inbox and uses AI to classify emails into three urgency levels: Urgent, Important, or Not Important. It automatically…
Source: https://n8n.io/workflows/10583/ — 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.
> Transform Your Email Workflow with Intelligent Automation
This n8n template demonstrates how to automatically process PDF purchase orders received via email and convert them into sales orders in Adobe Commerce (Magento 2) using Company Credit as the payment
AI marketing Team Agent. Uses toolWorkflow, telegram, memoryBufferWindow, openAi. Event-driven trigger; 46 nodes.
This workflow contains community nodes that are only compatible with the self-hosted version of n8n.
This n8n workflow template automates your lead generation and follow-up process using AI. It captures leads through a form, enriches them with company data, classifies them into different categories,