基于Google Drive RAG、GPT-4.1-mini和Cohere重排的WhatsApp支持机器人
高级
这是一个自动化工作流,包含 25 个节点。主要使用 Set, Merge, Switch, WhatsApp, GoogleDrive 等节点。 基于Google Drive RAG、GPT-4.1-mini和Cohere重排的WhatsApp支持机器人
前置要求
- •Google Drive API 凭证
- •可能需要目标 API 的认证凭证
- •OpenAI API Key
- •Supabase URL 和 API Key
使用的节点 (25)
分类
-
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"meta": {
"instanceId": "4554bb68a996ee908e0483a438b45e0b09c0f719ece2f844818367ebd1e83f3d",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "8b12986e-ee9a-4320-a8c1-408611d5206e",
"name": "Supabase 向量存储",
"type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
"position": [
608,
0
],
"parameters": {
"mode": "insert",
"options": {
"queryName": "match_documents"
},
"tableName": {
"__rl": true,
"mode": "list",
"value": "documents",
"cachedResultName": "documents"
}
},
"credentials": {
"supabaseApi": {
"id": "7XyHzj12T2jBDfJt",
"name": "Basil supa"
}
},
"typeVersion": 1.3
},
{
"id": "fc078081-e9fa-47ce-8ddb-aa1ece9c8971",
"name": "Google Drive 触发器",
"type": "n8n-nodes-base.googleDriveTrigger",
"position": [
0,
0
],
"parameters": {
"event": "fileUpdated",
"options": {},
"pollTimes": {
"item": [
{
"mode": "everyWeek",
"weekday": "0"
}
]
},
"triggerOn": "specificFolder",
"folderToWatch": {
"__rl": true,
"mode": "list",
"value": "1JCjixUoufxZRiFatfq-Nihr_vYRVoo2r",
"cachedResultUrl": "https://drive.google.com/drive/folders/1JCjixUoufxZRiFatfq-Nihr_vYRVoo2r",
"cachedResultName": "Holistic care"
}
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "kqw2ogr63uU80dBU",
"name": "Basil drive"
}
},
"typeVersion": 1
},
{
"id": "25499c2f-015c-4ce2-814f-e5aa74b71882",
"name": "编辑字段",
"type": "n8n-nodes-base.set",
"position": [
208,
0
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "c33387a9-a6ed-485a-8ed9-c3fdb646de3a",
"name": "id",
"type": "string",
"value": "={{ $json.id }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "26d8fbde-cbbb-4a9d-b3e8-aaa3c6707faa",
"name": "下载文件",
"type": "n8n-nodes-base.googleDrive",
"position": [
416,
0
],
"parameters": {
"fileId": {
"__rl": true,
"mode": "id",
"value": "={{ $json.id }}"
},
"options": {
"googleFileConversion": {
"conversion": {
"docsToFormat": "text/plain"
}
}
},
"operation": "download"
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "kqw2ogr63uU80dBU",
"name": "Basil drive"
}
},
"typeVersion": 3
},
{
"id": "0a652935-f8e0-4c2b-94a1-a30448337aae",
"name": "OpenAI 嵌入",
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
"position": [
560,
176
],
"parameters": {
"options": {}
},
"credentials": {
"openAiApi": {
"id": "LLSGsbD06g4Y8PTw",
"name": "carnival"
}
},
"typeVersion": 1.2
},
{
"id": "1082a42a-6116-441b-8a55-4cacaf400e85",
"name": "默认数据加载器",
"type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
"position": [
704,
144
],
"parameters": {
"options": {},
"dataType": "binary",
"textSplittingMode": "custom"
},
"typeVersion": 1.1
},
{
"id": "e92c1b20-a752-44f6-b590-0a5a24898576",
"name": "字符文本分割器",
"type": "@n8n/n8n-nodes-langchain.textSplitterCharacterTextSplitter",
"position": [
832,
272
],
"parameters": {
"chunkSize": 2000,
"separator": ".",
"chunkOverlap": 300
},
"typeVersion": 1
},
{
"id": "00a4a495-5a62-4c31-814d-66406e3d95e9",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-112,
-64
],
"parameters": {
"color": 4,
"width": 1200,
"height": 464,
"content": "## 将文档添加到向量存储"
},
"typeVersion": 1
},
{
"id": "fc14c2fb-e1c6-4e49-86eb-e54a96ac8a33",
"name": "OpenAI 聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
656,
-400
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini",
"cachedResultName": "gpt-4.1-mini"
},
"options": {
"temperature": 0.3
}
},
"credentials": {
"openAiApi": {
"id": "LLSGsbD06g4Y8PTw",
"name": "carnival"
}
},
"typeVersion": 1.2
},
{
"id": "eb8661ab-23d3-42a1-a63f-f9034195f8c0",
"name": "AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"onError": "continueRegularOutput",
"position": [
688,
-592
],
"parameters": {
"text": "={{ $json['text '] }}",
"options": {
"systemMessage": "=SYSTEM ROLE\nYou are intelligent and the best customer support agent for **HolistiCare (DHA, Lahore)**.\nTone: concise, friendly, courteous, professional. No emojis. Spartan wording.Be sympathetic and empathetic with the customer. \n\nCONTEXT \n\nHolistiCare is a multi-specialty clinic in DHA Phase 3, Lahore, providing care across: Dermatology/Aesthetics, Dentistry, Physiotherapy (incl. Hijama), Psychology & Psychiatry, Nutrition/Weight Loss, Pediatrics, Orthopedics, Gastroenterology, Urology, Neurology, Eye/Optometry, Internal Medicine/Diabetology/Endocrinology/Pulmonology, Gynecology, and Lab Testing.\n- The customer are frustrated and want good treatment always treat them in a way they feel appriciated \n- only converse with the user and provide them with information in a friendly manner \n- Ask the problems in a polite way and address them with a solution \n\n\ntool: 'Knowledge_base'\ndescription: use this tool to address user symtopms and their queries regarding the clinic and their symptoms. make sure the output is not more than a single paragraph \n\nBehaviour\n- Always try to sound like a human have two way communication with the user\n- Do not bombard them information guide them towards their needs and then provide them with a solution \n- do not draft an appointment message only address the customer query in a loving manner \n- Do not push the user to make an appointment \n- Only make an appointment when asked for \n- do not mention booking appointment if not asked \n\n\nGUARDRAILS\n- keep the replies under 100 words always \n- Keep replies short and non-repetitive.\n- Do **not** quote prices unless explicitly provided by the clinic in the 'Knowlege_base' tool\n- Do **not** provide medical advice; recommend a consult when needed.If not in the 'Knowledge_base'\n- If user insists on an unavailable service/doctor → suggest nearest department or route to front desk.\n- Prefer WhatsApp/phone handoff upon any ambiguity the agent cannot resolve quickly.\n\n\n"
},
"promptType": "define"
},
"typeVersion": 2
},
{
"id": "741188c9-3dfc-47e4-942b-604a8d248fda",
"name": "分支",
"type": "n8n-nodes-base.switch",
"position": [
-16,
-592
],
"parameters": {
"rules": {
"values": [
{
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "c0d70293-1022-4319-8103-fff749a376de",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.messages[0].type }}",
"rightValue": "text"
}
]
}
},
{
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "257bc935-a8ea-4a41-83c5-a1c1fecb5198",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.messages[0].type }}",
"rightValue": "audio"
}
]
}
}
]
},
"options": {}
},
"typeVersion": 3.2
},
{
"id": "4d5613df-dbba-480a-9698-2cd7b83fd86a",
"name": "HTTP 请求",
"type": "n8n-nodes-base.httpRequest",
"position": [
-144,
-432
],
"parameters": {
"url": "=https://graph.facebook.com/v21.0/{{ $('WhatsApp Trigger').item.json.messages[0].audio.id }}\n",
"options": {
"response": {
"response": {}
}
},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "access_token",
"value": "Your acces token here "
}
]
}
},
"typeVersion": 4.2
},
{
"id": "33301513-6459-4b63-a795-611f7d2bba4e",
"name": "翻译录音",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
240,
-432
],
"parameters": {
"options": {},
"resource": "audio",
"operation": "translate"
},
"credentials": {
"openAiApi": {
"id": "LLSGsbD06g4Y8PTw",
"name": "carnival"
}
},
"typeVersion": 1.8
},
{
"id": "ef1a43cf-6fac-4d86-8fe5-a025a478b825",
"name": "合并",
"type": "n8n-nodes-base.merge",
"position": [
240,
-592
],
"parameters": {},
"typeVersion": 3.2
},
{
"id": "2c97521c-21f5-4ba0-bf97-e16086f3252e",
"name": "Embeddings OpenAI1",
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
"position": [
912,
-256
],
"parameters": {
"options": {}
},
"credentials": {
"openAiApi": {
"id": "LLSGsbD06g4Y8PTw",
"name": "carnival"
}
},
"typeVersion": 1.2
},
{
"id": "4cc88c06-dd23-483b-95f6-097690e33a38",
"name": "Reranker Cohere",
"type": "@n8n/n8n-nodes-langchain.rerankerCohere",
"position": [
1072,
-256
],
"parameters": {},
"credentials": {
"cohereApi": {
"id": "wBVFsrsW1BO4F35G",
"name": "CohereApi account"
}
},
"typeVersion": 1
},
{
"id": "6842e6d5-691b-4588-b33d-71c941c0ab54",
"name": "发送消息",
"type": "n8n-nodes-base.whatsApp",
"position": [
1152,
-592
],
"webhookId": "9e097e1c-7c81-4286-bb05-df6b1e05d219",
"parameters": {
"textBody": "={{ $json.output }}",
"operation": "send",
"phoneNumberId": "668904212970806",
"additionalFields": {},
"recipientPhoneNumber": "={{ $('WhatsApp Trigger').item.json.messages[0].from }}"
},
"credentials": {
"whatsAppApi": {
"id": "lIJTty4i120llCjY",
"name": "Basil WA"
}
},
"typeVersion": 1
},
{
"id": "102f55f1-a7e9-425d-b4a7-ec7a78e57344",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-464,
-768
],
"parameters": {
"color": 5,
"width": 1856,
"height": 656,
"content": "## AI 代理"
},
"typeVersion": 1
},
{
"id": "900a3b8d-9095-4dd4-a3b2-d2104168e174",
"name": "WhatsApp 触发器",
"type": "n8n-nodes-base.whatsAppTrigger",
"position": [
-272,
-592
],
"webhookId": "3e4086bf-8e46-4489-9844-657dc6f96f73",
"parameters": {
"options": {},
"updates": [
"messages"
]
},
"credentials": {
"whatsAppTriggerApi": {
"id": "AyCa0qekMUCDvlXX",
"name": "basil WA"
}
},
"typeVersion": 1
},
{
"id": "cb6d7ba3-b42c-4644-ab1f-db72269491f5",
"name": "Kknowledge_base",
"type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
"position": [
880,
-400
],
"parameters": {
"mode": "retrieve-as-tool",
"topK": 10,
"options": {
"queryName": "match_documents"
},
"tableName": {
"__rl": true,
"mode": "list",
"value": "documents",
"cachedResultName": "documents"
},
"useReranker": true,
"toolDescription": "Use this tool to address customer queries regarding their symptoms and their queries regarding the clinic. "
},
"credentials": {
"supabaseApi": {
"id": "7XyHzj12T2jBDfJt",
"name": "Basil supa"
}
},
"typeVersion": 1.3
},
{
"id": "d0f0ece2-9bc5-49aa-aaf2-5132826b8f48",
"name": "简单记忆",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
592,
-240
],
"parameters": {
"sessionKey": "={{ $json.Phone }}",
"sessionIdType": "customKey"
},
"typeVersion": 1.3
},
{
"id": "6c1938a5-2674-4061-b5df-f48d34778273",
"name": "HTTP 请求",
"type": "n8n-nodes-base.httpRequest",
"position": [
64,
-432
],
"parameters": {
"url": "={{ $json.url }}",
"options": {
"response": {
"response": {
"responseFormat": "file"
}
}
},
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Authorization",
"value": "Bearer your access token here "
}
]
}
},
"typeVersion": 4.2
},
{
"id": "030178e3-1fe6-4ab9-bc3f-e83cbbbb4b8f",
"name": "编辑字段1",
"type": "n8n-nodes-base.set",
"position": [
416,
-592
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "29681984-eb3c-4c26-8de4-41fe8171abe2",
"name": "Phone",
"type": "string",
"value": "={{ $('WhatsApp Trigger').item.json.messages[0].from }}"
},
{
"id": "8d05b1e7-6035-42b2-8919-677ecd82fcbd",
"name": "text ",
"type": "string",
"value": "={{ $json.text }}{{ $json.messages[0].text.body }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "de45d6c0-1b61-4b0f-90de-d259838b60d4",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1264,
-3280
],
"parameters": {
"width": 768,
"height": 3136,
"content": "# WhatsApp → AI 代理 (OpenAI + Supabase 知识库) → 回复"
},
"typeVersion": 1
},
{
"id": "3d285ec3-4284-4fa9-8dd2-32d756bf5bab",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
1392,
-624
],
"parameters": {
"width": 1152,
"height": 2224,
"content": "# :自动摄取 Google Drive 文档到 Supabase 向量存储(用于您的知识库)"
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"Merge": {
"main": [
[
{
"node": "Edit Fields1",
"type": "main",
"index": 0
}
]
]
},
"Switch": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 0
}
],
[
{
"node": "HTTP Request",
"type": "main",
"index": 0
}
]
]
},
"AI Agent": {
"main": [
[
{
"node": "Send message",
"type": "main",
"index": 0
}
]
]
},
"Edit Fields": {
"main": [
[
{
"node": "Download file",
"type": "main",
"index": 0
}
]
]
},
"Edit Fields1": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request": {
"main": [
[
{
"node": "HTTP Request1",
"type": "main",
"index": 0
}
]
]
},
"Download file": {
"main": [
[
{
"node": "Supabase Vector Store",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request1": {
"main": [
[
{
"node": "Translate a recording",
"type": "main",
"index": 0
}
]
]
},
"Simple Memory": {
"ai_memory": [
[
{
"node": "AI Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"Kknowledge_base": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Reranker Cohere": {
"ai_reranker": [
[
{
"node": "Kknowledge_base",
"type": "ai_reranker",
"index": 0
}
]
]
},
"WhatsApp Trigger": {
"main": [
[
{
"node": "Switch",
"type": "main",
"index": 0
}
]
]
},
"Embeddings OpenAI": {
"ai_embedding": [
[
{
"node": "Supabase Vector Store",
"type": "ai_embedding",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Embeddings OpenAI1": {
"ai_embedding": [
[
{
"node": "Kknowledge_base",
"type": "ai_embedding",
"index": 0
}
]
]
},
"Default Data Loader": {
"ai_document": [
[
{
"node": "Supabase Vector Store",
"type": "ai_document",
"index": 0
}
]
]
},
"Google Drive Trigger": {
"main": [
[
{
"node": "Edit Fields",
"type": "main",
"index": 0
}
]
]
},
"Translate a recording": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 1
}
]
]
},
"Character Text Splitter": {
"ai_textSplitter": [
[
{
"node": "Default Data Loader",
"type": "ai_textSplitter",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
宠物店 4
🐶 宠物店预约 AI 代理
If
Set
Code
+41
187 节点Bruno Dias
人工智能
交付汉堡店MVP
🤖 餐厅与配送自动化的 AI 驱动 WhatsApp 助手
If
Set
Code
+37
152 节点Bruno Dias
AI智能助手:与Supabase存储和Google Drive文件对话
AI智能助手:与Supabase存储和Google Drive文件对话
If
Set
Wait
+20
62 节点Mark Shcherbakov
工程
商业AI指挥中心:Google Workspace模块化代理、向量搜索与多渠道报告
商业AI指挥中心:Google Workspace模块化代理、向量搜索与多渠道报告
Set
Gmail
Slack
+35
80 节点Paul
文档提取
AIAutomationPro终极RAG聊天机器人v1 n8n市场模板
多语言Telegram RAG聊天机器人,集成监督AI和自动化Google Drive流程
If
Set
Wait
+29
128 节点Daniel Ng
客服机器人
AI知识库助手与OpenAI、Supabase及Google Drive文档同步
AI知识库助手与OpenAI、Supabase及Google Drive文档同步
Set
Limit
Switch
+16
49 节点Abdul Mir
内部知识库