自动垃圾邮件/营销与优惠删除
中级
这是一个Other, AI领域的自动化工作流,包含 6 个节点。主要使用 If, Gmail, GmailTrigger, Agent, LmChatOpenAi 等节点,结合人工智能技术实现智能自动化。 Gmail AI邮件分类与自动删除(垃圾邮件/优惠清理)
前置要求
- •Google 账号和 Gmail API 凭证
- •OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "IYMbUalwaX81VJs4",
"meta": {
"instanceId": "740c1df6d3b1b6ea8a9d2223701f6904173f9e3cf7381cd181644b043420ba09",
"templateCredsSetupCompleted": true
},
"name": "自动垃圾邮件/营销与优惠删除",
"tags": [],
"nodes": [
{
"id": "d3c54552-91c2-4b7f-b9ce-f6cf2a28d615",
"name": "Gmail 触发器",
"type": "n8n-nodes-base.gmailTrigger",
"position": [
-80,
60
],
"parameters": {
"filters": {},
"pollTimes": {
"item": [
{
"mode": "everyHour"
}
]
}
},
"credentials": {
"gmailOAuth2": {
"id": "rhc6qwDoI5ghiukO",
"name": "Gmail TEST"
}
},
"typeVersion": 1.2
},
{
"id": "322d373c-84c9-4b2a-a68a-fc977788f973",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
140,
260
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-nano",
"cachedResultName": "gpt-4.1-nano"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "d2iBjQ0eOMCYOYLG",
"name": "OpenAi TEST API"
}
},
"typeVersion": 1.2
},
{
"id": "39ace162-640d-4350-9d43-142d335752be",
"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": "OFFER"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "89d0576e-1523-4684-9c7c-8af12464a648",
"name": "邮件验证器",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
160,
60
],
"parameters": {
"text": "=Tu masz ostatnią wiadomość email: \n {{ $json.snippet }}",
"options": {
"systemMessage": "=You are an intelligent assistant for analyzing and classifying emails or contact form messages.\n\nYour task is to accurately assess whether the message contains **valuable information** or is a **standard commercial message with no real value to the recipient**.\n\nWe distinguish three classes:\n\n1. `SPAM` – bulk messages, low-quality content, random text, scam, phishing, etc. \n2. `OFFER` – commercial or marketing messages that promote something but **do not contain information important to the user**, e.g.:\n - Discount coupons \n - Promotion or sale announcements \n - Abandoned cart reminders \n - Invitations to register, download, or purchase \n - Cold emails and collaboration offers \n3. `IMPORTAND` – messages containing **important information for the recipient**, even if commercial in nature, e.g.:\n - Order or payment confirmation \n - Shipping or delivery status \n - Message from a specific person with a question or request \n - Private matters, invitations, inquiries \n\nRules:\n- If in doubt, mark as `IMPORTAND`.\n- Focus on the message content, do not evaluate email address or headers.\n- Respond with only **one word**: `SPAM`, `OFFER`, or `IMPORTAND`.\n\nExamples:\n\nMessage: \n\"Your order #14235 has been shipped. Expected delivery: Thursday.\" \nResponse: `IMPORTAND` \n📌 This is important information for the user – do not delete.\n\n---\n\nMessage: \n\"You left something in your cart! Today only -15% off your purchase!\" \nResponse: `OFFER` \n📌 Typical marketing reminder, no concrete value.\n\n---\n\nMessage: \n\"Hi, we noticed you haven’t downloaded our free e-book. Download now and learn 10 ways to increase sales.\" \nResponse: `OFFER` \n📌 Marketing pitch, lacks important content.\n\n---\n\nMessage: \n\"Attached is the invoice for the service completed last month. Contact me if you have any questions.\" \nResponse: `IMPORTAND` \n📌 Invoice = important message.\n\n---\n\nMessage: \n\"Only today! Free shipping and up to -30% discounts in our store!\" \nResponse: `OFFER` \n📌 Promotion, typical commercial info.\n\n---\n\nMessage: \n\"Hi, I saw your ad online and I’m interested in collaborating. Can we talk by phone?\" \nResponse: `IMPORTAND` \n📌 Message from a specific person = potential lead.\n\n---\n\nMessage: \n\"Win a new iPhone! Click here and claim your prize!\" \nResponse: `SPAM` \n📌 No explanation needed – scam/spam.\n\n---\n\nMessage: \n\"I’d like to ask if you offer individual training?\" \nResponse: `IMPORTAND` \n📌 Genuine message from an interested customer.\n\n---\n\nMessage: \n\"Register now to get free access to XYZ tool for 7 days.\" \nResponse: `OFFER` \n📌 Promotional offer, not inherently important.\n"
},
"promptType": "define"
},
"typeVersion": 1.9
},
{
"id": "30698570-1181-4164-8d19-3e944fcae486",
"name": "删除邮件",
"type": "n8n-nodes-base.gmail",
"position": [
780,
60
],
"webhookId": "1640aa4d-44f3-435c-a67b-fa9ca2bd0186",
"parameters": {
"messageId": "={{ $('Gmail Trigger').item.json.id }}",
"operation": "delete"
},
"credentials": {
"gmailOAuth2": {
"id": "rhc6qwDoI5ghiukO",
"name": "Gmail TEST"
}
},
"typeVersion": 2.1
},
{
"id": "c1476511-b49b-410e-9665-47d04f26c92a",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
1040,
-260
],
"parameters": {
"width": 660,
"height": 1060,
"content": "### 📌 工作流:自动垃圾邮件/营销优惠清除器副本"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "988b967f-e77d-4698-af25-93c44b601aec",
"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)可能需要您自行付费。
相关工作流推荐
自动垃圾与营销邮件清理器
使用GPT-4和Gmail自动化垃圾邮件过滤
If
Gmail
Gmail Trigger
+3
6 节点LukaszB
其他
AI邮件自动回复系统 - 邮箱RAG智能代理
AI邮件自动回复系统 - 邮箱RAG智能代理
If
Set
Gmail
+18
34 节点LukaszB
客户支持
自动博客推广器 - 社交媒体帖子发布器
基于GPT的AI驱动博客文章推广器,用于Instagram、Facebook和X平台
If
Set
Code
+12
44 节点LukaszB
人工智能
🌲 使用Gmail和GPT-40进行可持续发展报告审计的AI代理
🌲 使用Gmail和GPT-40进行可持续发展报告审计的AI代理
If
Code
Gmail
+6
14 节点Samir Saci
其他
自动化博客撰写与社交媒体推广代理
使用GPT-4、Perplexity和WordPress自动化SEO博客创建+社交媒体
Set
Code
Gmail
+21
79 节点LukaszB
设计
在Braze中更新现有邮件模板
使用AI为Instagram、Facebook、LinkedIn和X自动化社交媒体内容
Set
Gmail
Merge
+22
73 节点LukaszB
设计
工作流信息
难度等级
中级
节点数量6
分类2
节点类型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 查看 →
分享此工作流