自动垃圾与营销邮件清理器
中级
这是一个Other, Support, AI领域的自动化工作流,包含 6 个节点。主要使用 If, Gmail, GmailTrigger, Agent, LmChatOpenAi 等节点,结合人工智能技术实现智能自动化。 使用GPT-4和Gmail自动化垃圾邮件过滤
前置要求
- •Google 账号和 Gmail API 凭证
- •OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "3QJW0AkGeIq3ofcC",
"meta": {
"instanceId": "740c1df6d3b1b6ea8a9d2223701f6904173f9e3cf7381cd181644b043420ba09",
"templateCredsSetupCompleted": true
},
"name": "自动垃圾与营销邮件清理器",
"tags": [],
"nodes": [
{
"id": "83cad1fb-1c94-4fa6-abc6-fc9084e84b8a",
"name": "Gmail 触发器",
"type": "n8n-nodes-base.gmailTrigger",
"position": [
-80,
60
],
"parameters": {
"filters": {},
"pollTimes": {
"item": [
{
"mode": "everyHour"
}
]
}
},
"credentials": {
"gmailOAuth2": {
"id": "ECavbdGSgi3lNgZG",
"name": "Gmail account 2"
}
},
"typeVersion": 1.2
},
{
"id": "38c3a768-5152-4377-9fa7-065e58233ef2",
"name": "OpenAI 聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
160,
280
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-nano",
"cachedResultName": "gpt-4.1-nano"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "69YTGxdIPy79gAdh",
"name": "OpenAi account"
}
},
"typeVersion": 1.2
},
{
"id": "4acc776b-0554-4a74-b10a-5307ee14fee2",
"name": "条件判断",
"type": "n8n-nodes-base.if",
"position": [
520,
60
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "or",
"conditions": [
{
"id": "3fa478cd-9476-4a10-b039-1e537b838b31",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.output }}",
"rightValue": "SPAM"
},
{
"id": "82bafdff-daed-4791-8dd0-dae981c0ee43",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.output }}",
"rightValue": "OFERTA"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "a2440f83-73b8-4757-90cf-c0f4d269eb9b",
"name": "邮件验证器",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
160,
60
],
"parameters": {
"text": "=Your email too check:\n {{ $json.snippet }}",
"options": {
"systemMessage": "=You are an intelligent assistant for analyzing and classifying email messages or contact forms.\n\nYour task is to carefully evaluate whether the message contains valuable information, or whether it is a standard marketing message with no real value to the recipient.\n\nWe distinguish three classes:\n\nSPAM – bulk messages, low-quality content, random text, scams, phishing, etc.\n\nOFFER – commercial or marketing messages that promote something but do not contain important information for the user, e.g.:\n\nDiscount coupons\n\nPromotion or sale notifications\n\nAbandoned cart reminders\n\nEncouragement to sign up, download, or buy\n\nCold emails and collaboration offers\n\nIMPORTANT – messages containing valuable or relevant information for the recipient, even if commercial in nature, e.g.:\n\nOrder or payment confirmation\n\nShipping or delivery status updates\n\nMessage from a specific person with a question or request\n\nPersonal matters, invitations, inquiries\n\nRules:\n\nIf you're unsure, better to classify as IMPORTANT.\n\nFocus on the message content, do not judge by the email address or headers.\n\nRespond with only one word: SPAM, OFFER, or IMPORTANT.\n\nExamples:\n\nMessage:\n“Your order #14235 has been shipped. Estimated delivery: Thursday.”\nAnswer: IMPORTANT\n📌 This is relevant information for the user – do not remove.\n\nMessage:\n“You left something in your cart! Only today –15% off your purchase!”\nAnswer: OFFER\n📌 Typical marketing reminder, no actual value.\n\nMessage:\n“Hi, we noticed you didn’t download our free e-book. Download now to discover 10 ways to boost sales.”\nAnswer: OFFER\n📌 Marketing prompt, lacks valuable content.\n\nMessage:\n“Attached is the invoice for the service completed last month. Please contact me with any questions.”\nAnswer: IMPORTANT\n📌 Invoice = important message.\n\nMessage:\n“Today only! Free shipping and discounts up to 30% in our store!”\nAnswer: OFFER\n📌 Promotion, typical sales message.\n\nMessage:\n“Hi, I saw your listing online and I’m interested in working with you. Can we talk by phone?”\nAnswer: IMPORTANT\n📌 Message from a real person = potential lead.\n\nMessage:\n“Win a new iPhone! Click here to claim your prize!”\nAnswer: SPAM\n📌 No need to explain – scam/spam.\n\nMessage:\n“I’d like to ask if you offer individual training sessions?”\nAnswer: IMPORTANT\n📌 A real inquiry from a potential customer.\n\nMessage:\n“Register now for free 7-day access to XYZ tool.”\nAnswer: OFFER\n📌 Advertising offer, not inherently important."
},
"promptType": "define"
},
"typeVersion": 1.9
},
{
"id": "77b25fbd-4093-48d1-9230-6a765d60b928",
"name": "删除邮件",
"type": "n8n-nodes-base.gmail",
"position": [
760,
60
],
"webhookId": "8c6da755-63e5-43e6-a22b-c189a72e7e7b",
"parameters": {
"messageId": "={{ $('Gmail Trigger').item.json.id }}",
"operation": "delete"
},
"credentials": {
"gmailOAuth2": {
"id": "ECavbdGSgi3lNgZG",
"name": "Gmail account 2"
}
},
"typeVersion": 2.1
},
{
"id": "a994bc19-d3fd-43b0-8612-bb9dfdceff08",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
940,
40
],
"parameters": {
"width": 560,
"height": 660,
"content": "## 🧹 自动垃圾与营销邮件清理器"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "0bbcd957-fdb2-4d3d-ac6b-f25903bbe301",
"connections": {
"If": {
"main": [
[
{
"node": "Delate Email",
"type": "main",
"index": 0
}
]
]
},
"Gmail Trigger": {
"main": [
[
{
"node": "Validator of Email",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "Validator of Email",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Validator of Email": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级 - 其他, 客户支持, 人工智能
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
AI邮件自动回复系统 - 邮箱RAG智能代理
AI邮件自动回复系统 - 邮箱RAG智能代理
If
Set
Gmail
+18
34 节点LukaszB
客户支持
自动垃圾邮件/营销与优惠删除
Gmail AI邮件分类与自动删除(垃圾邮件/优惠清理)
If
Gmail
Gmail Trigger
+3
6 节点LukaszB
其他
AI邮件分诊与GPT-4警报系统及Telegram通知
AI邮件分诊与GPT-4警报系统及Telegram通知
If
Set
Gmail
+22
104 节点Peter Joslyn
客户支持
自动博客推广器 - 社交媒体帖子发布器
基于GPT的AI驱动博客文章推广器,用于Instagram、Facebook和X平台
If
Set
Code
+12
44 节点LukaszB
人工智能
基于AI的MIS代理
基于AI的管理信息系统代理
If
Set
Code
+29
129 节点Kumar Shivam
客户支持
🌲 使用Gmail和GPT-40进行可持续发展报告审计的AI代理
🌲 使用Gmail和GPT-40进行可持续发展报告审计的AI代理
If
Code
Gmail
+6
14 节点Samir Saci
其他
工作流信息
难度等级
中级
节点数量6
分类3
节点类型6
作者
LukaszB
@lukaszbAI Automation Expert | Web & Mobile App Integrator With 2+ years of experience, I build smart automations, web & mobile app workflows, and scalable platforms using tools like n8n, Make, and more. I help businesses reduce operational costs, save time, and scale faster with AI-powered solutions. For business enquiries, send me an email at kontakt@lumizone.pl
外部链接
在 n8n.io 查看 →
分享此工作流