面向任何行业的AI驱动智能咨询与预订助手
这是一个Support Chatbot, AI Chatbot领域的自动化工作流,包含 12 个节点。主要使用 If, Code, Wait, Gmail, GmailTrigger 等节点。 使用Gmail和Gemini AI的自动邮件咨询处理与路由
- •Google 账号和 Gmail API 凭证
- •可能需要目标 API 的认证凭证
- •Google Gemini API Key
{
"id": "Jvq4AmoNIbbAwo5x",
"meta": {
"instanceId": "dd69efaf8212c74ad206700d104739d3329588a6f3f8381a46a481f34c9cc281",
"templateCredsSetupCompleted": true
},
"name": "面向任何行业的AI驱动智能咨询与预订助手",
"tags": [],
"nodes": [
{
"id": "e39522a9-4024-4b8e-84c0-4d77cd49e266",
"name": "Gmail 触发器",
"type": "n8n-nodes-base.gmailTrigger",
"position": [
-500,
120
],
"parameters": {
"simple": false,
"filters": {
"sender": "acdert@gmail.com"
},
"options": {},
"pollTimes": {
"item": [
{
"mode": "everyX",
"unit": "minutes"
}
]
}
},
"credentials": {
"gmailOAuth2": {
"id": "PcTqvGU9uCunfltE",
"name": "Gmail account - test"
}
},
"typeVersion": 1.2
},
{
"id": "92249d18-6db6-4e2b-a8c6-7cdaabf68360",
"name": "AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
-280,
120
],
"parameters": {
"text": "={{ $json.text }}",
"options": {
"systemMessage": "You are a smart AI assistant for [Business Name] (e.g., Cool Realty, AutoDeals, HealthPlus).\n\nBased on the customer’s message, decide the intent:\n\n\"check_info\" → if they request product/service availability, pricing, or details\n\n\"forward_action\" → if they want to book, buy, confirm, schedule, or take the next step\n\nReturn only one JSON including:\n\naction: either \"check_info\" or \"forward_action\"\n\nreasoning: brief summary of how you inferred the action\n\ndata_extracted: structured info from the email (e.g., name, date, service, etc.)\n\nreply: full, professional, human-like response to the user’s message\n\nBehavior logic:\n\nAssume 70% availability for requested service/product\n\nRandomly generate sample details (features, price, timelines, etc.)\n\nIf not available, suggest alternatives\n\nUse a warm, helpful, professional tone. Output only the JSON. No extra text.\n\n"
},
"promptType": "define"
},
"typeVersion": 1.9
},
{
"id": "1e6c541e-30c6-4a4b-86fd-8bc31ca4c798",
"name": "Google Gemini聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
-280,
340
],
"parameters": {
"options": {},
"modelName": "models/gemini-2.5-pro"
},
"credentials": {
"googlePalmApi": {
"id": "RvSkIBjP48ORJKhU",
"name": "Google Gemini(PaLM) Api account - test"
}
},
"typeVersion": 1
},
{
"id": "d98d2938-f78e-4d0d-a89f-a2629f58c1a9",
"name": "HTTP 请求",
"type": "n8n-nodes-base.httpRequestTool",
"disabled": true,
"position": [
-60,
320
],
"parameters": {
"url": "=https://google.serper.dev/search",
"method": "POST",
"options": {
"redirect": {
"redirect": {}
}
},
"sendBody": true,
"sendHeaders": true,
"bodyParameters": {
"parameters": [
{
"name": "=q",
"value": "={{ $fromAI('parameters0_Value', ``, 'string') }}"
}
]
},
"headerParameters": {
"parameters": [
{
"name": "X-API-KEY",
"value": "b05bf2fc7c01a8a70ecac675eafeb00777c8db22"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "5755463a-5ef3-409b-9c06-e1acb85e14e1",
"name": "代码",
"type": "n8n-nodes-base.code",
"position": [
60,
120
],
"parameters": {
"jsCode": "const output = [];\n\nfor (const item of $input.all()) {\n // 1. Grab the raw string from the 'output' field\n let raw = item.json.output;\n if (typeof raw !== 'string') {\n // nothing to do\n output.push({ json: {} });\n continue;\n }\n\n // 2. Remove `````` fences\n raw = raw.replace(/``````/g, '').trim();\n\n // 3. Extract the JSON payload between the first { and last }\n const start = raw.indexOf('{');\n const end = raw.lastIndexOf('}');\n const jsonString = (start !== -1 && end !== -1)\n ? raw.substring(start, end + 1)\n : raw;\n\n // 4. Attempt to parse\n try {\n const parsed = JSON.parse(jsonString);\n output.push({ json: parsed });\n } catch (e) {\n // on error, output the raw string and error\n output.push({\n json: {\n error: e.message,\n raw: jsonString\n }\n });\n }\n}\n\nreturn output;\n"
},
"typeVersion": 2
},
{
"id": "ba012b2b-8207-4639-b57b-79956c5bdba8",
"name": "如果",
"type": "n8n-nodes-base.if",
"position": [
460,
120
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "e4cc28d0-bee8-475a-b0fb-fa446fbfb954",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.action }}",
"rightValue": "check_availability"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "cbae6b70-6d91-4973-b149-6a960515f06b",
"name": "转发预订邮件",
"type": "n8n-nodes-base.gmail",
"position": [
720,
200
],
"webhookId": "482cede1-d0e5-4556-a1f7-e5c836dc8ae7",
"parameters": {
"sendTo": "abc@gmail.com",
"message": "=Name : {{ $json.customer_data.name }}\nEmail : {{ $json.customer_data.email }}\nPhone: {{ $json.customer_data.phone }}\nOriginal Message: {{ $json.customer_data.message }}\n\nInternal Note: {{ $json.internal_note }}\n\nSummary : {{ $json.booking_summary }}",
"options": {},
"subject": "Inquiry Details",
"emailType": "text"
},
"credentials": {
"gmailOAuth2": {
"id": "PcTqvGU9uCunfltE",
"name": "Gmail account - test"
}
},
"typeVersion": 2.1
},
{
"id": "7f784192-0b32-437c-bd2a-6ecb4b51f2c8",
"name": "可用性查询邮件",
"type": "n8n-nodes-base.gmail",
"position": [
720,
20
],
"webhookId": "482cede1-d0e5-4556-a1f7-e5c836dc8ae7",
"parameters": {
"sendTo": "={{ $json.customer_data.email }}",
"message": "={{ $('Code').item.json.email_response }}",
"options": {},
"subject": "Inquiry Details",
"emailType": "text"
},
"credentials": {
"gmailOAuth2": {
"id": "PcTqvGU9uCunfltE",
"name": "Gmail account - test"
}
},
"typeVersion": 2.1
},
{
"id": "99fc6c79-6888-4093-968b-668f8cec525b",
"name": "工作流概览",
"type": "n8n-nodes-base.stickyNote",
"position": [
-520,
-160
],
"parameters": {
"width": 780,
"height": 240,
"content": "## 工作流概览 📧"
},
"typeVersion": 1
},
{
"id": "0333faf4-3690-487a-a151-ac329c1eacd8",
"name": "AI代理与代码说明",
"type": "n8n-nodes-base.stickyNote",
"position": [
120,
400
],
"parameters": {
"color": 5,
"width": 600,
"height": 320,
"content": "## AI代理与代码节点详解 🤖"
},
"typeVersion": 1
},
{
"id": "1772a67e-ac94-45f5-b37d-1ef3084b9891",
"name": "条件路由与邮件回复",
"type": "n8n-nodes-base.stickyNote",
"position": [
300,
-280
],
"parameters": {
"color": 4,
"width": 600,
"height": 280,
"content": "## 条件路由与邮件回复 🚦"
},
"typeVersion": 1
},
{
"id": "3cfad505-0925-4b8d-b275-c7e319764925",
"name": "等待数据",
"type": "n8n-nodes-base.wait",
"position": [
280,
120
],
"webhookId": "4e0cbcd3-6378-4ff8-bda1-cd43550f3088",
"parameters": {},
"typeVersion": 1.1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "1dd6ab03-d62a-4ed1-b2da-1f254160ff20",
"connections": {
"If": {
"main": [
[
{
"node": "availability check email",
"type": "main",
"index": 0
}
],
[
{
"node": "Forward booking email",
"type": "main",
"index": 0
}
]
]
},
"Code": {
"main": [
[
{
"node": "Wait for Data",
"type": "main",
"index": 0
}
]
]
},
"AI Agent": {
"main": [
[
{
"node": "Code",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Gmail Trigger": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"Wait for Data": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"Google Gemini Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
}
}
}如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级 - 客服机器人, AI 聊天机器人
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
Oneclick AI Squad
@oneclick-aiThe AI Squad Initiative is a pioneering effort to build, automate and scale AI-powered workflows using n8n.io. Our mission is to help individuals and businesses integrate AI agents seamlessly into their daily operations from automating tasks and enhancing productivity to creating innovative, intelligent solutions. We design modular, reusable AI workflow templates that empower creators, developers and teams to supercharge their automation with minimal effort and maximum impact.
分享此工作流