使用 Google Gemini 和 Supabase 创建智能 FAQ
中级
这是一个Support Chatbot, AI Chatbot领域的自动化工作流,包含 15 个节点。主要使用 If, Set, Supabase, Telegram, Agent 等节点。 使用 Google Gemini 和 Supabase 创建智能 FAQ Telegram 机器人
前置要求
- •Supabase URL 和 API Key
- •Telegram Bot Token
- •Google Gemini API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"meta": {
"instanceId": "7dc12cc14b4f095cedd2e9549d98eb1aca95241b7bf74a764272500de1b801ec"
},
"nodes": [
{
"id": "588b691b-8305-4761-89b2-e5e1d2d0699e",
"name": "Telegram触发器",
"type": "n8n-nodes-base.telegramTrigger",
"position": [
-752,
656
],
"webhookId": "43dc004e-cda7-4eb6-95b5-61486b0bdf6d",
"parameters": {
"updates": [
"message"
],
"additionalFields": {}
},
"typeVersion": 1.2
},
{
"id": "2a241435-d6d1-41ba-8432-d44f4d837ef3",
"name": "Google Gemini 聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
224,
1184
],
"parameters": {
"options": {}
},
"typeVersion": 1
},
{
"id": "802a6326-3858-4d8f-9d85-d2e7dc78e80c",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-816,
496
],
"parameters": {
"color": 4,
"height": 288,
"content": "## 步骤1:接收用户消息"
},
"typeVersion": 1
},
{
"id": "ab604f07-25fc-4580-af0d-07f26dd120eb",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
80,
304
],
"parameters": {
"color": 5,
"width": 272,
"height": 176,
"content": "## 新用户路径"
},
"typeVersion": 1
},
{
"id": "08891444-00d4-46f0-b539-7aa3298b84ce",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-384,
496
],
"parameters": {
"color": 4,
"width": 336,
"height": 288,
"content": "## 步骤2:检查用户是否为新用户"
},
"typeVersion": 1
},
{
"id": "2ec0132b-6c2f-444c-834c-219ccd785996",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
432,
1152
],
"parameters": {
"color": 3,
"height": 208,
"content": "## 现有用户路径"
},
"typeVersion": 1
},
{
"id": "d03a256a-7bbf-493c-83bd-4e2fa5738e23",
"name": "便签说明4",
"type": "n8n-nodes-base.stickyNote",
"position": [
48,
736
],
"parameters": {
"color": 4,
"width": 432,
"height": 336,
"content": "## 步骤3:生成AI答案"
},
"typeVersion": 1
},
{
"id": "76eaef61-75d6-4ce3-8d11-436fe4e75665",
"name": "便签说明5",
"type": "n8n-nodes-base.stickyNote",
"position": [
528,
768
],
"parameters": {
"color": 4,
"width": 368,
"height": 272,
"content": "## 步骤4:发送AI响应"
},
"typeVersion": 1
},
{
"id": "e3c8e646-890d-45db-b3ef-6e9689352c15",
"name": "检查用户是否存在于Supabase中",
"type": "n8n-nodes-base.supabase",
"position": [
-528,
656
],
"parameters": {
"filters": {
"conditions": [
{
"keyName": "chat_id",
"keyValue": "={{ $json.message.chat.id }}"
}
]
},
"tableId": "telegram_users",
"operation": "get"
},
"credentials": {
"supabaseApi": {
"id": "1pgFwqTKn45GzSXW",
"name": "Supabase account"
}
},
"typeVersion": 1
},
{
"id": "601fc8b2-886b-436a-a337-3f47e3ba52e5",
"name": "路由:新用户还是现有用户?",
"type": "n8n-nodes-base.if",
"position": [
-304,
656
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "f4e144b5-d1b4-4752-9ad3-4c85d9e246cb",
"operator": {
"type": "number",
"operation": "empty",
"singleValue": true
},
"leftValue": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "ff0ec30f-d2df-402a-a442-cd548102c1dc",
"name": "将新用户保存到Supabase",
"type": "n8n-nodes-base.supabase",
"position": [
144,
512
],
"parameters": {
"tableId": "telegram_users",
"fieldsUi": {
"fieldValues": [
{
"fieldId": "chat_id",
"fieldValue": "={{ $('Telegram Trigger').item.json.message.chat.id }}"
}
]
}
},
"credentials": {
"supabaseApi": {
"id": "1pgFwqTKn45GzSXW",
"name": "Supabase account"
}
},
"typeVersion": 1
},
{
"id": "8314f5f5-f8a4-412e-93f7-571ca2efebb5",
"name": "发送欢迎消息(新用户)",
"type": "n8n-nodes-base.telegram",
"position": [
368,
512
],
"webhookId": "cf7e2a9e-221f-4e34-a6a7-54d8548d4e61",
"parameters": {
"text": "Thank you for trying my project. You can also check out the FAQ or ask any questions you may have. If you want to see the FAQ here, just click this link |/Who_are_you?/What_can_you_do?/Who_created_you?/Are_you_free?",
"chatId": "={{ $('Telegram Trigger').item.json.message.from.id }}",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "9GazysyOQ96DLdaD",
"name": "Telegram account"
}
},
"typeVersion": 1.2
},
{
"id": "bdffd8ec-9f55-435a-8063-c683ad45ac68",
"name": "为AI加载FAQ上下文",
"type": "n8n-nodes-base.set",
"position": [
-80,
896
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "994d25f7-381c-4bb2-94c1-cd99e72948dd",
"name": "faq_context",
"type": "string",
"value": "Q: Who are you? A: I am an automated assistant bot created to learn n8n and AI. Q: What can you do? A: Currently, I can answer basic questions about myself. In the future, I will be developed to do other things. Q: Who created you? A: I was created by the owner of this n8n server using Google Gemini and n8n. Q: Are you free? A: Yes, I am a learning project and free to use."
}
]
}
},
"typeVersion": 3.4
},
{
"id": "0f6a6366-543d-4e74-86e1-07c856bd2249",
"name": "使用Gemini处理问题",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
144,
896
],
"parameters": {
"text": "=Anda adalah asisten bot yang ramah dan membantu. Tugas Anda adalah menjawab pertanyaan pengguna berdasarkan Konteks FAQ yang diberikan. Jika pertanyaan pengguna tidak bisa dijawab dari konteks, jawab dengan benar pertanyaan tersebut\nJika pengguna bertanya terkait \"apa saja faq nya\" kamu bisa memberi semua pertanyaan yang tertera di faq dengan mengawali pertanyaan dengan / dan hilangkan spasi yang terkandung dalam pertanyaan ganti lah dengan underscore\"_\" \n--- KONTEKS FAQ ---\n{{ $json.faq_context }}\n--- AKHIR KONTEKS ---\n\nPertanyaan Pengguna: {{ $('Telegram Trigger').item.json.message.text }}",
"options": {},
"promptType": "define"
},
"typeVersion": 2.2
},
{
"id": "5cd2bd5b-fcff-4be9-9341-16e52e65cdc1",
"name": "向用户发送AI答案",
"type": "n8n-nodes-base.telegram",
"position": [
640,
896
],
"webhookId": "b73acbf7-3457-47f2-9ee3-499301eb820e",
"parameters": {
"text": "={{ $json.output.replace(/[*_`[\\]()]/g, \"\") }}",
"chatId": "={{ $('Telegram Trigger').item.json.message.from.id }}",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "9GazysyOQ96DLdaD",
"name": "Telegram account"
}
},
"typeVersion": 1.2
}
],
"pinData": {},
"connections": {
"588b691b-8305-4761-89b2-e5e1d2d0699e": {
"main": [
[
{
"node": "e3c8e646-890d-45db-b3ef-6e9689352c15",
"type": "main",
"index": 0
}
]
]
},
"bdffd8ec-9f55-435a-8063-c683ad45ac68": {
"main": [
[
{
"node": "0f6a6366-543d-4e74-86e1-07c856bd2249",
"type": "main",
"index": 0
}
]
]
},
"2a241435-d6d1-41ba-8432-d44f4d837ef3": {
"ai_languageModel": [
[
{
"node": "0f6a6366-543d-4e74-86e1-07c856bd2249",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"ff0ec30f-d2df-402a-a442-cd548102c1dc": {
"main": [
[
{
"node": "8314f5f5-f8a4-412e-93f7-571ca2efebb5",
"type": "main",
"index": 0
}
]
]
},
"0f6a6366-543d-4e74-86e1-07c856bd2249": {
"main": [
[
{
"node": "5cd2bd5b-fcff-4be9-9341-16e52e65cdc1",
"type": "main",
"index": 0
}
]
]
},
"601fc8b2-886b-436a-a337-3f47e3ba52e5": {
"main": [
[
{
"node": "ff0ec30f-d2df-402a-a442-cd548102c1dc",
"type": "main",
"index": 0
}
],
[
{
"node": "bdffd8ec-9f55-435a-8063-c683ad45ac68",
"type": "main",
"index": 0
}
]
]
},
"e3c8e646-890d-45db-b3ef-6e9689352c15": {
"main": [
[
{
"node": "601fc8b2-886b-436a-a337-3f47e3ba52e5",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级 - 客服机器人, AI 聊天机器人
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
Telegram支持交接自动化
使用GPT4和邮件提醒自动化Telegram支持从AI到人工的交接
If
Set
Switch
+
If
Set
Switch
40 节点Meelioo
客服机器人
WhatsApp/Telegram WooCommerce订单支持
通过Telegram和Gmail使用Gemini和GPT自动化WooCommerce客户支持
Set
Gmail
Merge
+
Set
Gmail
Merge
25 节点AppStoneLab Technologies LLP
客服机器人
J.A.R.V.I.S.
在Telegram上使用OpenAI、SERP和向量存储构建全面的多模态助手
If
Set
Code
+
If
Set
Code
48 节点FabioInTech
客服机器人
通过 Telegram 预约医生
基于Telegram、Gemini AI和Google Sheets的医生预约调度系统
Set
Switch
Telegram
+
Set
Switch
Telegram
18 节点Abdul Matheen
客服机器人
宠物美容发布与预约自动化
使用AI、Facebook和Telegram机器人自动化宠物美容发布与预约
If
Set
Switch
+
If
Set
Switch
36 节点Christian Moises
AI 聊天机器人
使用Gemini、语音和图像生成构建多模态Telegram AI助手
使用Gemini、语音和图像生成构建多模态Telegram AI助手
If
Set
Code
+
If
Set
Code
95 节点Iniyavan JC
个人效率