8
n8n 中文网amn8n.com

AI 驱动的邮件分类和自动回复系统

高级

这是一个Ticket Management, AI Summarization领域的自动化工作流,包含 24 个节点。主要使用 Agent, MicrosoftOutlook, LmChatOpenAi, MicrosoftOutlookTrigger, TextClassifier 等节点。 使用 Outlook 和 GPT-4 分类邮件并自动回复

前置要求
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "Yn7tmZK650FOKDSc",
  "meta": {
    "instanceId": "25e77c0c6022d4bb0bf1d4755e6d167b4f61a12eba4f980e0349847ef576722f",
    "templateCredsSetupCompleted": true
  },
  "name": "AI 驱动的邮件分类和自动回复系统",
  "tags": [],
  "nodes": [
    {
      "id": "c1f2aa2b-570c-4d6b-b0c8-13f9cea4bbf7",
      "name": "Microsoft Outlook 触发器",
      "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 聊天模型 - 分类器",
      "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": "回复紧急邮件",
      "type": "n8n-nodes-base.microsoftOutlook",
      "position": [
        1056,
        288
      ],
      "webhookId": "3caba703-2528-468e-a341-438501e066f6",
      "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 邮件分类器",
      "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": "生成紧急回复",
      "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 聊天模型 - 紧急",
      "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": "回复重要邮件",
      "type": "n8n-nodes-base.microsoftOutlook",
      "position": [
        1040,
        912
      ],
      "webhookId": "3caba703-2528-468e-a341-438501e066f6",
      "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": "生成重要回复",
      "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 聊天模型 - 重要",
      "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": "移动到非重要文件夹",
      "type": "n8n-nodes-base.microsoftOutlook",
      "position": [
        1504,
        1344
      ],
      "webhookId": "91e15089-2724-4a8e-8685-2b269143dab6",
      "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": "回复非重要邮件",
      "type": "n8n-nodes-base.microsoftOutlook",
      "position": [
        1088,
        1456
      ],
      "webhookId": "3caba703-2528-468e-a341-438501e066f6",
      "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": "生成标准回复",
      "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 聊天模型 - 标准",
      "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": "移动到紧急文件夹",
      "type": "n8n-nodes-base.microsoftOutlook",
      "position": [
        1552,
        400
      ],
      "webhookId": "1e0359d8-469f-491e-8f43-aa5556c91782",
      "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": "移动到重要文件夹",
      "type": "n8n-nodes-base.microsoftOutlook",
      "position": [
        1536,
        880
      ],
      "webhookId": "1e0359d8-469f-491e-8f43-aa5556c91782",
      "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": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1216,
        240
      ],
      "parameters": {
        "width": 480,
        "height": 780,
        "content": "## AI 驱动的邮件分类和自动回复系统"
      },
      "typeVersion": 1
    },
    {
      "id": "217734d2-91cc-4041-87ac-0602b251b5be",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -576,
        528
      ],
      "parameters": {
        "color": 7,
        "width": 380,
        "height": 768,
        "content": "## 1. 邮件触发器"
      },
      "typeVersion": 1
    },
    {
      "id": "70d4589a-7e80-471b-95b9-95947667231e",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -64,
        528
      ],
      "parameters": {
        "color": 7,
        "width": 420,
        "height": 772,
        "content": "## 2. AI 邮件分类"
      },
      "typeVersion": 1
    },
    {
      "id": "c95221f7-d0cd-43ff-9e21-de799663b9ff",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        448,
        -16
      ],
      "parameters": {
        "color": 7,
        "width": 804,
        "height": 552,
        "content": "## 3A. 紧急邮件路径"
      },
      "typeVersion": 1
    },
    {
      "id": "91c7df05-e1c1-4a9e-a5c6-d2f6880ecd69",
      "name": "便签说明4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        448,
        592
      ],
      "parameters": {
        "color": 7,
        "width": 804,
        "height": 536,
        "content": "## 3B. 重要邮件路径"
      },
      "typeVersion": 1
    },
    {
      "id": "f69cb8b1-a631-47ce-92bb-8bfce1a560dc",
      "name": "便签说明5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        448,
        1184
      ],
      "parameters": {
        "color": 7,
        "width": 804,
        "height": 528,
        "content": "## 3C. 非重要邮件路径"
      },
      "typeVersion": 1
    },
    {
      "id": "00dd4800-5592-4a09-ad18-a0aecb174232",
      "name": "便签 6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1344,
        -16
      ],
      "parameters": {
        "color": 7,
        "width": 472,
        "height": 1736,
        "content": "## 4. 邮件组织"
      },
      "typeVersion": 1
    },
    {
      "id": "17cbe272-f507-4f06-b33d-25bebd644efc",
      "name": "便签 7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1168,
        1088
      ],
      "parameters": {
        "color": 5,
        "width": 360,
        "height": 240,
        "content": "## ⚠️ 重要配置说明"
      },
      "typeVersion": 1
    },
    {
      "id": "8d384320-be21-4688-a7d4-b16c97408ebc",
      "name": "## 为什么选择 4o 模型?👆",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1168,
        1424
      ],
      "parameters": {
        "color": 6,
        "width": 360,
        "height": 200,
        "content": "## 💡 自定义提示"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "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
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

高级 - 工单管理, AI 摘要总结

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
高级
节点数量24
分类2
节点类型6
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者
Mattis

Mattis

@iiiii

Consultant et expert en automatisation. Co-fondateur de l'agence PerformAi. Pas qu'un simple créateur, j'écoute et comprends l'importance pour simplifier votre activité au quotidien. On en discute ?

外部链接
在 n8n.io 查看

分享此工作流