8
n8n 中文网amn8n.com

智能Gmail分类器:使用OpenAI进行分类和标记

中级

这是一个AI Summarization, Multimodal AI领域的自动化工作流,包含 8 个节点。主要使用 Cron, Gmail, LmChatOpenAi, TextClassifier 等节点。 使用GPT-4o-mini自定义分类自动标记Gmail消息

前置要求
  • Google 账号和 Gmail API 凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "MkRETKpIFPWYCRiM",
  "meta": {
    "instanceId": "3d02c71388317a973647ceedf481a6b7f92941c766cf17f67388ab341d525980",
    "templateCredsSetupCompleted": true
  },
  "name": "智能Gmail分类器:使用openAI进行分类和标记",
  "tags": [],
  "nodes": [
    {
      "id": "9038f706-1cf8-4156-9858-969a7bde62e3",
      "name": "OpenAI 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -848,
        576
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "h5qIkLzWPJjRPGNc",
          "name": "OpenAi account 2"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "0ee542ce-85bc-405a-ba04-7a257e8d6f4f",
      "name": "工作机会",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -544,
        0
      ],
      "webhookId": "5f643023-07de-4b83-a2f7-5f0014a2ec69",
      "parameters": {
        "labelIds": [
          "Label_3116546262966183424"
        ],
        "messageId": "={{ $('Gmail Trigger').item.json.id }}",
        "operation": "addLabels"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "L68pElfU0dElPrnw",
          "name": "Gmail account 3"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "ee69125c-46ae-439d-b0b7-c016af1b5df6",
      "name": "申请状态",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -544,
        192
      ],
      "webhookId": "5f643023-07de-4b83-a2f7-5f0014a2ec69",
      "parameters": {
        "labelIds": [
          "Label_1823036576628176913"
        ],
        "messageId": "={{ $('Gmail Trigger').item.json.id }}",
        "operation": "addLabels"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "L68pElfU0dElPrnw",
          "name": "Gmail account 3"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "37f396b6-7327-43db-b4e5-e34756b82a34",
      "name": "其他",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -544,
        384
      ],
      "webhookId": "5f643023-07de-4b83-a2f7-5f0014a2ec69",
      "parameters": {
        "labelIds": [
          "Label_4879539884577568757"
        ],
        "messageId": "={{ $('Gmail Trigger').item.json.id }}",
        "operation": "addLabels"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "L68pElfU0dElPrnw",
          "name": "Gmail account 3"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "d937e43b-7f05-4eda-bf9e-409a325f6999",
      "name": "咨询",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -544,
        576
      ],
      "webhookId": "5f643023-07de-4b83-a2f7-5f0014a2ec69",
      "parameters": {
        "labelIds": [
          "Label_2255072803109768357"
        ],
        "messageId": "={{ $('Gmail Trigger').item.json.id }}",
        "operation": "addLabels"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "L68pElfU0dElPrnw",
          "name": "Gmail account 3"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "eb4f2bf6-4535-4b96-a215-5c99f3f0bb04",
      "name": "邮件分类器",
      "type": "@n8n/n8n-nodes-langchain.textClassifier",
      "position": [
        -944,
        288
      ],
      "parameters": {
        "options": {
          "systemPromptTemplate": "=Please classify the text provided by the user into one of the following categories: {categories}, and use the provided formatting instructions below. Don't explain, and only output the json."
        },
        "inputText": "={{ $json.text }}",
        "categories": {
          "categories": [
            {
              "category": "Job Opportunity",
              "description": "Emails that reflects potential jobs matched as per the profile i've shared across various job sites"
            },
            {
              "category": "Application Status",
              "description": "Email that updates about any jobs i applied or any updates about the position i interviewed for or the position i didn't get selected"
            },
            {
              "category": "Others",
              "description": "The rest of email communication that does not fall under Job Opportunity or Application Status"
            },
            {
              "category": "Enquiries",
              "description": "Email that raise enquiry about my details or the work i do or the service i provide."
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "1e886235-18c7-4f6e-a744-7a177807e00a",
      "name": "每日邮件检查",
      "type": "n8n-nodes-base.cron",
      "position": [
        -1392,
        288
      ],
      "parameters": {
        "triggerTimes": {
          "item": [
            {
              "hour": 23
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "07c859f1-82ff-4268-bd99-087608931420",
      "name": "获取新邮件",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -1168,
        288
      ],
      "webhookId": "e76d0a4c-ea02-4ea4-b427-027315c1a846",
      "parameters": {
        "limit": 10,
        "simple": false,
        "filters": {
          "receivedAfter": "2025-08-10T17:28:41"
        },
        "options": {},
        "operation": "getAll"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "L68pElfU0dElPrnw",
          "name": "Gmail account 3"
        }
      },
      "typeVersion": 2
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "7aa60bda-b007-4b69-b22a-aac8d578e193",
  "connections": {
    "Email Classifier": {
      "main": [
        [
          {
            "node": "Job Opportunity",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Application Status",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Others",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Enquiries",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch New Emails": {
      "main": [
        [
          {
            "node": "Email Classifier",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Daily Email Check": {
      "main": [
        [
          {
            "node": "Fetch New Emails",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Email Classifier",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

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

需要付费吗?

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

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

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

作者
Ashish Kumar Swain

Ashish Kumar Swain

@phoenix

Hi, I’m Ashish — an automation architect and AI enthusiast helping people work smarter. I build AI-powered workflows that save time, boost productivity, and create real-world impact. Passionate about no-code, startups, and smart systems that scale. Let’s automate success, one workflow at a time! 🚀

外部链接
在 n8n.io 查看

分享此工作流