8
n8n 中文网amn8n.com

简单邮件分类器

中级

这是一个AI Summarization, Multimodal AI领域的自动化工作流,包含 8 个节点。主要使用 Gmail, GmailTrigger, LmChatOpenAi, TextClassifier 等节点。 基于GPT-4 Mini分类的Gmail邮件自动分类

前置要求
  • Google 账号和 Gmail API 凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "GW8BgSXuDRHwmSI6",
  "meta": {
    "instanceId": "e73c77a832a4af1fdbfd95e61201dd65dffb85871e88031e3f1475c5661e7b54",
    "templateCredsSetupCompleted": true
  },
  "name": "简单邮件分类器",
  "tags": [],
  "nodes": [
    {
      "id": "a06f8baa-e67e-49ed-b471-74fc05fc6b38",
      "name": "Gmail 触发器",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        -560,
        192
      ],
      "parameters": {
        "filters": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "2B6GbcGNkQi4VDzQ",
          "name": "Gmail account"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "fc3e3e26-d404-412c-8d2d-03988214773c",
      "name": "文本分类器",
      "type": "@n8n/n8n-nodes-langchain.textClassifier",
      "position": [
        -352,
        160
      ],
      "parameters": {
        "options": {},
        "inputText": "=subject: {{ $json.Subject }}\nMessage: {{ $json.snippet }}",
        "categories": {
          "categories": [
            {
              "category": "Business",
              "description": "Anything from friends or co-workers related to work"
            },
            {
              "category": "Sales",
              "description": "Anything sounds like a cold email or someone trying to sell you something soft or hard way"
            },
            {
              "category": "Meetings",
              "description": "anything mentioning a meeting or a schedule or maybe a reminder"
            },
            {
              "category": "Random",
              "description": "Anything that doesn't fall into our 3 categories"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "8eb5fcae-9d32-445f-88a1-4203585be43a",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -352,
        384
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "iuyzWhX2JGVK5PCn",
          "name": "OpenAI Hostinger"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "1a4ea43d-2cc5-4931-bd5f-8adeebe20334",
      "name": "无操作,不执行任何操作",
      "type": "n8n-nodes-base.noOp",
      "position": [
        0,
        368
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "190c147b-d1e0-4aa0-ad3f-eadc012ff546",
      "name": "商务",
      "type": "n8n-nodes-base.gmail",
      "position": [
        0,
        0
      ],
      "webhookId": "f69cb642-4f22-4d3a-8107-af33f3760576",
      "parameters": {
        "labelIds": [
          "IMPORTANT"
        ],
        "resource": "thread",
        "threadId": "={{ $('Gmail Trigger').item.json.id }}",
        "operation": "addLabels"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "2B6GbcGNkQi4VDzQ",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "780c4ca1-a6c6-404b-8643-498a4badb9bf",
      "name": "冷邮件",
      "type": "n8n-nodes-base.gmail",
      "position": [
        192,
        96
      ],
      "webhookId": "0a6b8d61-f922-4462-b8b3-26bb6d6aec27",
      "parameters": {
        "resource": "thread",
        "threadId": "={{ $json.id }}",
        "operation": "delete"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "2B6GbcGNkQi4VDzQ",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "6ca3d75f-410b-49a1-a685-7bbbad760074",
      "name": "会议",
      "type": "n8n-nodes-base.gmail",
      "position": [
        192,
        256
      ],
      "webhookId": "f69cb642-4f22-4d3a-8107-af33f3760576",
      "parameters": {
        "labelIds": [
          "YELLOW_STAR"
        ],
        "resource": "thread",
        "threadId": "={{ $('Gmail Trigger').item.json.id }}",
        "operation": "addLabels"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "2B6GbcGNkQi4VDzQ",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "4befbb3e-c00c-443d-b216-90f61cf5ac64",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -928,
        128
      ],
      "parameters": {
        "color": 6,
        "width": 272,
        "height": 240,
        "content": "## 指南"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "72a6698f-fc14-4c0a-8838-3f08023a5220",
  "connections": {
    "Gmail Trigger": {
      "main": [
        [
          {
            "node": "Text Classifier",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Text Classifier": {
      "main": [
        [
          {
            "node": "Business",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Cold Emails",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Meetings",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Text Classifier",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - AI 摘要总结, 多模态 AI

需要付费吗?

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

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

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

作者
Ilyass Kanissi

Ilyass Kanissi

@ilyass

I design and build custom no-code and low-code automations using n8n to help businesses save hours of manual work, streamline operations, and create clean, scalable workflows.

外部链接
在 n8n.io 查看

分享此工作流