使用 GPT-4o-mini 和 Gmail 中的人工审核自动化邮件回复
中级
这是一个自动化工作流,包含 14 个节点。主要使用 If, Gmail, GmailTrigger, ChainLlm, LmChatOpenAi 等节点。 使用 GPT-4o-mini 和 Gmail 人工审核实现邮件回复自动化
前置要求
- •Google 账号和 Gmail API 凭证
- •OpenAI API Key
分类
-
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "YwTxqfTx1nnu0SLw",
"meta": {
"instanceId": "15d6057a37b8367f33882dd60593ee5f6cc0c59310ff1dc66b626d726083b48d",
"templateCredsSetupCompleted": true
},
"name": "使用 GPT-4o-mini 和 Gmail 中的人工审核自动化邮件回复",
"tags": [
"GPT-4o-mini",
"Gmail",
"Human-in-the-loop",
"AI",
"Automation",
"Email Responder",
"Sales"
],
"nodes": [
{
"id": "8129d250-e99b-48ea-a3a5-e9fb4728a623",
"name": "发送审核",
"type": "n8n-nodes-base.gmail",
"position": [
1840,
1536
],
"webhookId": "d62eb733-4e9f-420a-9b3d-5993448b85b1",
"parameters": {
"sendTo": "reviewer@example.com",
"message": "=Original Customer Email:\n---\n{{ $('Gmail Trigger1').item.json.text }}\n---\n\nAI-Generated Reply (Draft):\n---\n{{ $json.output.body }}\n---\n\nPlease reply to this email with \"approve\" to send, or provide feedback for revision.",
"options": {},
"subject": "=RE: {{ $('Classify Potential Leads').item.json.subject }}",
"operation": "sendAndWait",
"responseType": "freeText"
},
"credentials": {
"gmailOAuth2": {
"id": "S97D1LtEAoJViOUO",
"name": "Gmail account"
}
},
"typeVersion": 2.1
},
{
"id": "7e7642e7-0635-43e0-a608-f2262717a9fb",
"name": "✅ 发送给客户",
"type": "n8n-nodes-base.gmail",
"position": [
2336,
1360
],
"webhookId": "543e2088-a720-4131-a924-81c72196164f",
"parameters": {
"sendTo": "={{ $('Gmail Trigger1').item.json.from.value[0].address }}",
"message": "={{ $json.output.body }}",
"options": {
"appendAttribution": false
},
"subject": "={{ $json.output.subject }}",
"emailType": "text"
},
"credentials": {
"gmailOAuth2": {
"id": "S97D1LtEAoJViOUO",
"name": "Gmail account"
}
},
"typeVersion": 2.1
},
{
"id": "41f86e19-ffba-49aa-b83a-bbd62a648171",
"name": "是否批准?",
"type": "n8n-nodes-base.if",
"position": [
2048,
1536
],
"parameters": {
"options": {
"caseSensitive": false
},
"conditions": {
"string": [
{
"value1": "={{ $json.data.text }}",
"value2": "approve",
"operation": "contains"
},
{
"value1": "={{ $json.data.text }}",
"value2": "承認",
"operation": "contains"
}
]
},
"combineOperation": "any"
},
"typeVersion": 1
},
{
"id": "bfed408e-b2ba-4a17-9260-d8a4c3dfc12c",
"name": "Gmail Trigger1",
"type": "n8n-nodes-base.gmailTrigger",
"position": [
864,
1552
],
"parameters": {
"simple": false,
"filters": {},
"options": {},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
}
},
"credentials": {
"gmailOAuth2": {
"id": "S97D1LtEAoJViOUO",
"name": "Gmail account"
}
},
"typeVersion": 1.2
},
{
"id": "6e872edb-3a18-42d3-8c15-af2e1d92eee8",
"name": "无操作,不执行任何操作1",
"type": "n8n-nodes-base.noOp",
"position": [
1296,
1744
],
"parameters": {},
"typeVersion": 1
},
{
"id": "29cbeac3-9b59-4dce-82d0-3a74e343c662",
"name": "OpenAI Chat Model(用于分类器)",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
1088,
1744
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "PlV73EwiIxyWywLc",
"name": "OpenAi account"
}
},
"typeVersion": 1.2
},
{
"id": "c444e590-b47d-4b90-aa8b-68a0e81ad61c",
"name": "分类潜在客户",
"type": "@n8n/n8n-nodes-langchain.textClassifier",
"position": [
1088,
1552
],
"parameters": {
"options": {
"fallback": "other"
},
"inputText": "={{ $json.text }}",
"categories": {
"categories": [
{
"category": "AI Leads",
"description": "=Routes emails that are potential AI leads. Catches inquiries about pricing, implementation, or requests for more information. Also identifies emails describing a business problem or task they want to solve or automate using AI, such as automating customer service or phone calls."
}
]
}
},
"typeVersion": 1
},
{
"id": "e3610bb3-ce48-4c4b-aa0c-f1004f02a85b",
"name": "基础 LLM 链",
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"position": [
1488,
1536
],
"parameters": {
"text": "={{ $('Classify Potential Leads').item.json.text }}",
"messages": {
"messageValues": [
{
"message": "=# Role:\nYou are an AI Sales Development Representative (SDR) for **Momentum AI**, an agency specializing in custom AI automation solutions. Your primary role is to respond to inbound emails from potential leads who have questions about Momentum AI's products and services.\n\n# Mission:\nYour mission is to act as the first point of contact, building trust by resolving the lead's initial questions and challenges, with the ultimate goal of advancing them to the next stage in the sales funnel, such as a product demo or a specialist consultation.\n\n# Guiding Principles:\n1. **Customer-Centric:** Always strive to understand the lead's business challenges and position your response as a contribution to their solution.\n2. **Accuracy & Transparency:** Provide information based *exclusively* on the Knowledge Base below. If a question cannot be answered, state this transparently and never speculate or invent information.\n3. **Proactive Engagement:** Do not let the conversation end with a simple Q&A. Always propose a logical and beneficial next step to deepen the engagement and move the conversation forward.\n4. **Tone of Voice:** Maintain a professional, yet friendly and reliable tone, positioning yourself as a helpful \"AI partner.\" Avoid excessive jargon and explain concepts in clear, simple terms.\n\n# Response Generation Workflow:\n1. **Step 1: Analyze Intent:**\n * Carefully read the inbound email to identify the lead's **primary questions**, their potential underlying **business needs**, and their current stage (**e.g., early information gathering vs. ready to implement**).\n\n2. **Step 2: Retrieve Information & Construct Response:**\n * Consult the **Knowledge Base (FAQs)** below to find the relevant information for each question.\n * Structure your response as follows:\n * **1. Opening:** Thank the sender for their inquiry and briefly acknowledge their main question (e.g., \"Thank you for reaching out with your questions about our AI agent pricing.\").\n * **2. Body:** Answer each of the lead's questions clearly and concisely, using information from the Knowledge Base. Rephrase the information into a natural, conversational format—do not simply copy and paste.\n * **3. Call to Action (CTA):** Based on the nature of their inquiry, propose the most appropriate next step using the **\"CTA Logic\"** section below.\n\n3. **Step 3: Handle Exceptions:**\n * If the Knowledge Base does not contain the answer to a specific question, respond honestly and professionally. Never invent an answer. Use one of the following approaches:\n * **Example 1 (for technical questions):** \"That's an excellent question. To give you the most accurate technical details on that, I'd like to connect you with one of our solution architects. Would you be open to a brief call with them?\"\n * **Example 2 (for general unknowns):** \"I don't have the specific details for that particular question at hand. However, I can connect you with a specialist on our team who can provide a comprehensive answer. May I make that introduction?\"\n\n---\n# Knowledge Base (FAQs):\n\n* **Q: What kind of AI agents does Momentum AI build?**\n * A: We specialize in building bespoke AI agents that automate and optimize specific business workflows. Common examples include **(1) Intelligent Customer Support Agents** that resolve inquiries across email and chat, **(2) Automated Lead Qualification Agents** that score and route new leads, **(3) Internal Knowledge Base Assistants** that help your team find information instantly, and **(4) Data Entry & Processing Agents** that handle tedious administrative tasks. Every agent is custom-built from the ground up to meet your unique operational needs.\n\n* **Q: What does your pricing look like?**\n * A: Our pricing is tailored to the project's scope. We typically offer a **one-time project fee** for initial development and a **monthly subscription fee** for hosting, maintenance, and ongoing performance tuning. The final cost depends on the agent's complexity and the number of systems it needs to integrate with. We always start with a complimentary discovery call to understand your goals, after which we can provide a detailed proposal and a transparent quote.\n\n* **Q: What is the development timeline for a custom AI agent?**\n * A: Our process is agile and collaborative. A typical project timeline is **6-12 weeks**, broken down into three phases: **(1) Discovery & Design (1-2 weeks)**, where we map out your process and define the agent's logic. **(2) Development & Integration (4-8 weeks)**, where we build and connect the agent. **(3) Testing & Deployment (1-2 weeks)**, where we ensure everything works perfectly before going live. We provide a more precise timeline after the initial discovery phase.\n\n* **Q: What makes Momentum AI different from off-the-shelf AI tools?**\n * A: Our key differentiator is our **consulting-led approach**. We don't just provide software; we partner with you to deeply analyze your existing workflows and re-engineer them for maximum AI efficiency. Unlike rigid, pre-built tools, our custom solutions are infinitely flexible and designed to integrate seamlessly into your exact processes. Furthermore, we provide a dedicated performance dashboard and ongoing optimization to ensure you achieve a clear ROI.\n\n* **Q: What systems can your agents integrate with?**\n * A: Our agents are built for flexibility and can integrate with virtually any system that offers an API. We have extensive experience connecting with CRMs (like **Salesforce, HubSpot**), support desks (**Zendesk, Intercom**), communication platforms (**Slack, Microsoft Teams**), and internal databases. If a standard API isn't available, we can often develop a custom connector to bridge the gap.\n\n---\n# Call-to-Action (CTA) Logic:\n* **If the lead asks about pricing or quotes:**\n * \"To provide you with an accurate quote, I'd suggest a brief 15-minute call to discuss your specific requirements. You can book a time that works for you directly on this calendar: [Link to Calendar]\"\n* **If the lead asks vague questions about features or use cases:**\n * \"It might be helpful to see our AI agents in action. Would you be interested in a short, personalized demo where we can show you how it could work for a business like yours?\"\n* **If the lead asks highly technical or integration-specific questions:**\n * \"For technical details like that, it's best to speak directly with our solutions architect. Shall I coordinate a brief meeting for you with them?\"\n* **If the lead seems to be in an early information-gathering stage:**\n * \"We have a document that provides a more detailed overview of our services. Would you like me to send that over? You might also find the case studies on our website helpful: [Link to Case Studies Page]\"\n\n# Constraints:\n* Do not speculate or provide information that is not in the Knowledge Base.\n* Do not make definitive promises about product features or pricing.\n* Never speak negatively about competitors.\n* If an email is clearly spam or not a genuine inquiry, respond with a polite, generic message and end the conversation: \"Thank you for your message. If you have specific questions about Momentum AI services, please let us know.\"\n\n# Signature:\nAlways end your emails with the following signature.\n\n---\nBest regards,\n\nYUSUKE YAMAMOTO\nSales Development, Momentum AI\n[Company Website URL]\n---\n\n# Task Definition:\nYour task is determined by the data provided in the \"Input Data\" section below.\n1. **If ONLY a `[Customer's Email]` is provided:** This is a **first draft creation**. Follow the \"Response Generation Workflow\" to write a new email response from scratch based on the customer's inquiry.\n2. **If BOTH `[Human Feedback]` and `[Previous Email Draft]` are provided:** This is a **revision task**. Analyze the human's feedback and revise the `[Previous Email Draft]` to incorporate their suggestions. Do not start from scratch. Focus ONLY on applying the requested changes to the previous draft.\n\n# Input Data:\nThe input will be a combination of the following data fields. Some fields may be empty depending on the task.\n\n[Customer's Email]:\n\"\"\"\n{{ $('Classify Potential Leads').item.json.text }}\n\"\"\"\n\n[Human Feedback]:\n\"\"\"\n{{ $if($('IF Approved?').isExecuted, $('IF Approved?').last().item.json.data.text, '') }}\n\"\"\"\n\n[Previous Email Draft]:\n\"\"\"\n{{ $if($('IF Approved?').isExecuted, $self.item.json.output.body, '') }}\n\"\"\"\n"
}
]
},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 1.6
},
{
"id": "12714d3d-ee8a-4daa-a9e1-717404404c6a",
"name": "结构化输出解析器",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
1632,
1744
],
"parameters": {
"jsonSchemaExample": "{\n \"subject\": \"This is an example subject line.\",\n \"body\": \"This is an example email body.\\nIt can have multiple lines.\"\n}"
},
"typeVersion": 1.3
},
{
"id": "9df68f69-8cc9-46a5-869d-5f03310381a4",
"name": "OpenAI Chat Model(用于 LLM Chain)",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
1488,
1744
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "PlV73EwiIxyWywLc",
"name": "OpenAi account"
}
},
"typeVersion": 1.2
},
{
"id": "e6f54c9a-d971-460d-8549-d3369a19c52f",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
848,
1296
],
"parameters": {
"color": 6,
"width": 540,
"height": 220,
"content": "### 阶段 1:邮件接收与分类"
},
"typeVersion": 1
},
{
"id": "0d8ac3be-a67b-4835-9430-8c20141b655a",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
1440,
1104
],
"parameters": {
"color": 5,
"width": 540,
"height": 400,
"content": "### 阶段 2:AI 草稿生成"
},
"typeVersion": 1
},
{
"id": "5062a472-a4f6-49a5-8664-d62153579b38",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
1800,
1040
],
"parameters": {
"color": 2,
"width": 540,
"height": 460,
"content": "### 阶段 3:人工审核与循环"
},
"typeVersion": 1
},
{
"id": "5fa2379e-4a6f-474c-83b5-4b533e54b6d0",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
2296,
1120
],
"parameters": {
"color": 4,
"width": 540,
"height": 200,
"content": "### 阶段 4:最终操作"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "334a762e-0d9b-4ec3-9f2c-ebab56adf947",
"connections": {
"IF Approved?": {
"main": [
[
{
"node": "✅ Send to Customer",
"type": "main",
"index": 0
}
],
[
{
"node": "Basic LLM Chain",
"type": "main",
"index": 0
}
]
]
},
"Gmail Trigger1": {
"main": [
[
{
"node": "Classify Potential Leads",
"type": "main",
"index": 0
}
]
]
},
"Basic LLM Chain": {
"main": [
[
{
"node": "Send for Review",
"type": "main",
"index": 0
}
]
]
},
"Send for Review": {
"main": [
[
{
"node": "IF Approved?",
"type": "main",
"index": 0
}
]
]
},
"Classify Potential Leads": {
"main": [
[
{
"node": "Basic LLM Chain",
"type": "main",
"index": 0
}
],
[
{
"node": "No Operation, do nothing1",
"type": "main",
"index": 0
}
]
]
},
"Structured Output Parser": {
"ai_outputParser": [
[
{
"node": "Basic LLM Chain",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"OpenAI Chat Model (for LLM Chain)": {
"ai_languageModel": [
[
{
"node": "Basic LLM Chain",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"OpenAI Chat Model (for Classifier)": {
"ai_languageModel": [
[
{
"node": "Classify Potential Leads",
"type": "ai_languageModel",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
AI邮件分诊与GPT-4警报系统及Telegram通知
AI邮件分诊与GPT-4警报系统及Telegram通知
If
Set
Gmail
+22
104 节点Peter Joslyn
客户支持
在可视化参考库中探索n8n节点
在可视化参考库中探索n8n节点
If
Ftp
Set
+93
113 节点I versus AI
其他
使用GPT、Google日历和Supabase的自动邮件管理系统
使用GPT、Google日历和Supabase的自动邮件管理系统
If
Code
Gmail
+15
42 节点Abdul Mir
工单管理
使用Google Gemini和人工参与学习的自动邮件支持
使用Google Gemini和人工参与学习的自动邮件支持
If
Set
Gmail
+9
29 节点Lucas Peyrin
内容创作
✨🔪 基于Llama Parse的高级AI文档解析与文本提取
✨🔪 基于Llama Parse的高级AI文档解析与文本提取
If
Set
Gmail
+14
54 节点Joseph LePage
构建模块
使用AI(GPT-4o)自动化数字产品和SaaS销售
使用AI(GPT-4o)自动化数字产品和SaaS销售
If
Code
Wait
+14
34 节点Badr
销售
工作流信息
难度等级
中级
节点数量14
分类-
节点类型9
作者
YUSUKE YAMAMOTO
@yusuke-yamamotoBusiness creator from Tokyo. Designing AI-driven automations that enhance marketing, reporting, and daily operations. I turn complex workflows into simple, elegant automations with n8n.
外部链接
在 n8n.io 查看 →
分享此工作流