AI 驱动的邮件自动化
高级
这是一个Social Media, AI Chatbot领域的自动化工作流,包含 21 个节点。主要使用 GmailTool, GoogleDocs, ManualTrigger, Agent, ChatTrigger 等节点。 使用 Google Docs、Pinecone、GPT-4o 和 Gmail 的个性化邮件自动化
前置要求
- •Google 账号和 Gmail API 凭证
- •OpenAI API Key
- •Pinecone API Key
使用的节点 (21)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "1AeBTEXwiwxSvJ37",
"meta": {
"instanceId": "82cad572864ecfae931ea0fa4a2122d5ad401b8f2cb25fb3ff144b553e0d676d"
},
"name": "AI 驱动的邮件自动化",
"tags": [],
"nodes": [
{
"id": "c3066810-8dd0-4b1c-8daa-ea5892551d7d",
"name": "当点击\"测试工作流\"时",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-140,
-860
],
"parameters": {},
"typeVersion": 1
},
{
"id": "8b6c598a-547a-485a-a294-68c562ef86be",
"name": "Pinecone 向量存储",
"type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
"position": [
340,
-860
],
"parameters": {
"mode": "insert",
"options": {
"pineconeNamespace": "docsmail"
},
"pineconeIndex": {
"__rl": true,
"mode": "list",
"value": "n8ndocs",
"cachedResultName": "n8ndocs"
}
},
"typeVersion": 1
},
{
"id": "7c86d348-875a-4b57-94c2-ad37c10a24cf",
"name": "OpenAI 嵌入",
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
"position": [
200,
-660
],
"parameters": {
"options": {}
},
"typeVersion": 1.2
},
{
"id": "70d44b68-e1f6-4794-9114-a20dcfe9fa7d",
"name": "默认数据加载器",
"type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
"position": [
360,
-640
],
"parameters": {
"options": {}
},
"typeVersion": 1
},
{
"id": "d8e2ae43-88ae-4bc4-818a-e46fea4968fb",
"name": "递归字符文本分割器",
"type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
"position": [
400,
-480
],
"parameters": {
"options": {},
"chunkSize": 200,
"chunkOverlap": 50
},
"typeVersion": 1
},
{
"id": "1e43f542-5498-4626-981a-076c2748553f",
"name": "当被另一个工作流执行时",
"type": "n8n-nodes-base.executeWorkflowTrigger",
"position": [
20,
600
],
"parameters": {
"inputSource": "passthrough"
},
"typeVersion": 1.1
},
{
"id": "4c0907b1-32b4-498b-838b-d8c1377930a1",
"name": "AI 代理",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
240,
600
],
"parameters": {
"text": "={{ $json.query }}",
"options": {
"systemMessage": "You are a helpful assistant to send mails."
},
"promptType": "define"
},
"typeVersion": 1.7
},
{
"id": "6603a4d8-52c3-49cb-a3ad-32ccb6f1427c",
"name": "OpenAI 聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
200,
860
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini"
},
"options": {}
},
"typeVersion": 1.2
},
{
"id": "79342d85-a9d0-459a-8b2b-ae60a2d09006",
"name": "Gmail",
"type": "n8n-nodes-base.gmailTool",
"position": [
500,
860
],
"webhookId": "0efa4972-e3dc-4c40-a6cd-ebf1acbb1ead",
"parameters": {
"sendTo": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('To', ``, 'string') }}",
"message": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message', ``, 'string') }}",
"options": {},
"subject": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Subject', ``, 'string') }}"
},
"typeVersion": 2.1
},
{
"id": "65054e26-803c-4cbf-89f9-be90411ee1ad",
"name": "当收到聊天消息时",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
0,
-200
],
"webhookId": "e3978e41-4d95-4d3a-a2a1-b1f9f8c222bb",
"parameters": {
"options": {}
},
"typeVersion": 1.1
},
{
"id": "772f7733-5d42-4add-977e-a6f398adb683",
"name": "向量存储邮件",
"type": "@n8n/n8n-nodes-langchain.toolVectorStore",
"position": [
180,
40
],
"parameters": {
"name": "Vectorstore_mails",
"description": "使用此工具获取邮件信息,您可以找到所有相关邮件地址,也可以提供邮件地址。"
},
"typeVersion": 1
},
{
"id": "c8087076-86c2-4600-ba2e-54ca42441fad",
"name": "OpenAI 聊天模型1",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
420,
220
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o",
"cachedResultName": "gpt-4o"
},
"options": {}
},
"typeVersion": 1.2
},
{
"id": "1567e58b-ae16-49f8-8913-3222bb870a9d",
"name": "发送邮件",
"type": "@n8n/n8n-nodes-langchain.toolWorkflow",
"position": [
540,
60
],
"parameters": {
"name": "send_mail",
"workflowId": {
"__rl": true,
"mode": "list",
"value": "GLkrSkyYtlep3P6e",
"cachedResultName": "Send Mails Pinecone"
},
"description": "使用此工具发送邮件。",
"workflowInputs": {
"value": {},
"schema": [],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
}
},
"typeVersion": 2
},
{
"id": "cda619f9-9e41-4559-8580-2830b675fe7a",
"name": "AI 代理1",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
220,
-200
],
"parameters": {
"options": {
"systemMessage": "=# Role: \nYou are an intelligent email agent that automatically sends personalized emails to recipients. Your task is to generate and send a clear, professional, and accurate email based on the provided names, email addresses, and desired content. \n\n## Rules & Behavior: \n\n# You have 2 Tools and need to use them correctly, you always use both tools, first the Vectorstore_mails after that the send_mail\n\n## Vectorstore_mails \nUse this tool to get Email adresses, you can get all mail adresses from pinecone.\nwinter test = winterIsComming@gmail.com\n\n## send_mail\nUse this tool to send mails.\n\n### Email Format: \n- The email must include a **subject line**. \n- It should begin with an appropriate **salutation** (e.g., \"Hello [Name]\" or \"Dear [Name]\"). \n- The **main content** should be clear, concise, and friendly. \n- The email should end with a **suitable closing phrase** (e.g., \"Best regards, Arnie\"). \n\n### Dynamic Personalization: \n- Automatically replace the placeholder **[Name]** with the recipient’s actual name. \n- If the name is missing, use a general salutation such as **\"Hello, dear team\"**. \n\n### Review & Optimization: \n- Avoid unnecessary **repetitions or vague wording**. \n- If the message is **too long or unstructured, summarize it clearly**. \n\n## Email Types (Adaptable Based on Context): \n- Standard information email \n- Reminder or follow-up \n- Offer or marketing email \n- Support or customer service request \n\n---\n\n### Example of a Generated Email: \n\n**Subject:** Important Information for You, [Name] \n\n**Text:** \nHello [Name], \n\nI hope you are doing well. I wanted to quickly inform you about [Topic]. If you have any questions or need further information, feel free to reach out. \n\nBest regards, \nSender Name \n"
}
},
"typeVersion": 1.7
},
{
"id": "e8a2fbef-5534-423c-bcc0-c007a67ad83e",
"name": "OpenAI 聊天模型2",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
20,
60
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o",
"cachedResultName": "gpt-4o"
},
"options": {}
},
"typeVersion": 1.2
},
{
"id": "79c33b28-a1f8-4b25-a1f4-c9110929aa0a",
"name": "Pinecone 向量存储1",
"type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
"position": [
60,
220
],
"parameters": {
"options": {
"pineconeNamespace": "docsmail"
},
"pineconeIndex": {
"__rl": true,
"mode": "list",
"value": "n8ndocs",
"cachedResultName": "n8ndocs"
}
},
"typeVersion": 1
},
{
"id": "bc1ddbcc-52aa-4f05-9c16-2b5cc42cc1b1",
"name": "OpenAI 嵌入1",
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
"position": [
120,
360
],
"parameters": {
"options": {}
},
"typeVersion": 1.2
},
{
"id": "6e44ad97-d77c-434f-b869-3101c1046ced",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-860,
-860
],
"parameters": {
"width": 660,
"height": 360,
"content": "#### **第一步**"
},
"typeVersion": 1
},
{
"id": "ec252e7d-44e1-47f3-a7bd-104615e7eb82",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-860,
-120
],
"parameters": {
"color": 6,
"width": 760,
"height": 420,
"content": "#### **第二步**"
},
"typeVersion": 1
},
{
"id": "0de864f4-6b36-41d2-a4b0-5e51a7ad961c",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-840,
580
],
"parameters": {
"color": 5,
"width": 800,
"height": 340,
"content": "#### **第三步**"
},
"typeVersion": 1
},
{
"id": "a44c0e8e-34c0-4ff1-888e-0a841e5434d2",
"name": "获取文档",
"type": "n8n-nodes-base.googleDocs",
"position": [
80,
-860
],
"parameters": {
"operation": "get",
"documentURL": "https://docs.google.com/document/*********"
},
"typeVersion": 2
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "9b5962d2-17e0-4471-92c8-548dec3af37b",
"connections": {
"Gmail": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"send_mail": {
"ai_tool": [
[
{
"node": "AI Agent1",
"type": "ai_tool",
"index": 0
}
]
]
},
"Get a document": {
"main": [
[
{
"node": "Pinecone Vector Store",
"type": "main",
"index": 0
}
]
]
},
"Embeddings OpenAI": {
"ai_embedding": [
[
{
"node": "Pinecone Vector Store",
"type": "ai_embedding",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Vectorstore Mails": {
"ai_tool": [
[
{
"node": "AI Agent1",
"type": "ai_tool",
"index": 0
}
]
]
},
"Embeddings OpenAI1": {
"ai_embedding": [
[
{
"node": "Pinecone Vector Store1",
"type": "ai_embedding",
"index": 0
}
]
]
},
"OpenAI Chat Model1": {
"ai_languageModel": [
[
{
"node": "Vectorstore Mails",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"OpenAI Chat Model2": {
"ai_languageModel": [
[
{
"node": "AI Agent1",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Default Data Loader": {
"ai_document": [
[
{
"node": "Pinecone Vector Store",
"type": "ai_document",
"index": 0
}
]
]
},
"Pinecone Vector Store1": {
"ai_vectorStore": [
[
{
"node": "Vectorstore Mails",
"type": "ai_vectorStore",
"index": 0
}
]
]
},
"When chat message received": {
"main": [
[
{
"node": "AI Agent1",
"type": "main",
"index": 0
}
]
]
},
"Recursive Character Text Splitter": {
"ai_textSplitter": [
[
{
"node": "Default Data Loader",
"type": "ai_textSplitter",
"index": 0
}
]
]
},
"When Executed by Another Workflow": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"When clicking ‘Test workflow’": {
"main": [
[
{
"node": "Get a document",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 社交媒体, AI 聊天机器人
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
用于潜在客户捕获和业务问答的 AI Chatbot
基于 GPT-4o、Pinecone 和 Google Sheets 的自动化线索捕获与业务问答
Google Drive
Agent
Google Sheets Tool
+10
17 节点Belgacem Dhiflaoui
客户培育
在可视化参考库中探索n8n节点
在可视化参考库中探索n8n节点
If
Ftp
Set
+93
113 节点I versus AI
其他
AI邮件自动回复系统 - 邮箱RAG智能代理
AI邮件自动回复系统 - 邮箱RAG智能代理
If
Set
Gmail
+18
34 节点LukaszB
客户支持
BambooHR AI 驱动的公司政策和福利聊天机器人
BambooHR AI 驱动的公司政策和福利聊天机器人
Set
Filter
Bamboo Hr
+20
50 节点Ludwig
人力资源
商业AI指挥中心:Google Workspace模块化代理、向量搜索与多渠道报告
商业AI指挥中心:Google Workspace模块化代理、向量搜索与多渠道报告
Set
Gmail
Slack
+35
80 节点Paul
文档提取
基于 GPT-4、Stripe 和 CRM 集成的 WooCommerce 对话式销售代理
基于 GPT-4、Stripe 和 CRM 集成的 WooCommerce 对话式销售代理
Set
Google Drive
Http Request
+16
27 节点Cong Nguyen
AI 聊天机器人