我的工作流4
高级
这是一个Support Chatbot, Miscellaneous, Multimodal AI领域的自动化工作流,包含 30 个节点。主要使用 If, Set, Merge, Supabase, WhatsApp 等节点。 为1万+客户支持聊天创建双向WhatsApp + Telegram集成
前置要求
- •Supabase URL 和 API Key
- •可能需要目标 API 的认证凭证
- •Telegram Bot Token
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "x67YFG3vNxQ65Sxi",
"meta": {
"instanceId": "54982cbe9f8132ea9a4a7e9e8f355b9eb6ea3f69d2ba679cde0f482c65ee4fcb"
},
"name": "我的工作流 4",
"tags": [],
"nodes": [
{
"id": "4eacb345-2777-4560-9ec4-24a1d8c2111f",
"name": "Telegram 触发器",
"type": "n8n-nodes-base.telegramTrigger",
"position": [
64,
768
],
"webhookId": "f01d522b-e6d4-4167-b882-93cd7342a5f0",
"parameters": {
"updates": [
"message"
],
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "dDbhzco6ZNjgEzvE",
"name": "Telegram account"
}
},
"typeVersion": 1.2
},
{
"id": "84fa0a6d-6a55-4033-9304-7d3186e67db5",
"name": "筛选主题中的回复消息",
"type": "n8n-nodes-base.set",
"position": [
288,
768
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "97b4a02e-f409-4312-b04f-a61ebe579e0a",
"name": "superGroupID",
"type": "number",
"value": -1003071123489
},
{
"id": "3356c433-668f-44a7-9851-57e3181b7119",
"name": "message",
"type": "string",
"value": "={{ $json.message.text }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "1eb7429d-7838-4983-9617-4aac384f06e7",
"name": "获取行",
"type": "n8n-nodes-base.supabase",
"position": [
736,
768
],
"parameters": {
"filters": {
"conditions": [
{
"keyName": "telegram_topic_id",
"keyValue": "={{ $('Telegram Trigger').item.json.message.message_thread_id }}"
}
]
},
"tableId": "wa_tg_threads",
"operation": "get"
},
"credentials": {
"supabaseApi": {
"id": "LbJH45H5lL5IehHN",
"name": "Supabase account"
}
},
"typeVersion": 1
},
{
"id": "d97ae6ec-0310-4328-a480-44a1dfbaa41b",
"name": "发送消息",
"type": "n8n-nodes-base.whatsApp",
"position": [
960,
768
],
"webhookId": "ecdc6fc4-41c2-4469-b1d9-d945342eb30d",
"parameters": {
"textBody": "={{ $('Filter messages that are replies in topics').item.json.message }}",
"operation": "send",
"phoneNumberId": "792860623405890",
"additionalFields": {},
"recipientPhoneNumber": "={{ $json.phone_e164 }}"
},
"credentials": {
"whatsAppApi": {
"id": "zJEUtyOU44mPb74x",
"name": "WhatsApp System token"
}
},
"typeVersion": 1
},
{
"id": "49ff481e-8301-4933-9522-8363c9b69478",
"name": "条件判断",
"type": "n8n-nodes-base.if",
"position": [
512,
768
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "9ed4e660-862c-4c52-9406-5800772318ab",
"operator": {
"type": "number",
"operation": "equals"
},
"leftValue": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
"rightValue": "={{ $json.superGroupID }}"
},
{
"id": "49a7f363-676b-4b4c-bcc2-7aa027cad020",
"operator": {
"type": "string",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.message }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "52861634-26d4-4a4c-92b5-4898e6a7dd4f",
"name": "创建一行",
"type": "n8n-nodes-base.supabase",
"position": [
2112,
272
],
"parameters": {
"tableId": "wa_tg_threads",
"fieldsUi": {
"fieldValues": [
{
"fieldId": "phone_e164",
"fieldValue": "={{ $('Customer Details').item.json.CustomerPhone }}"
},
{
"fieldId": "telegram_topic_id",
"fieldValue": "={{ $json.result.message_thread_id }}"
},
{
"fieldId": "supergroup_id",
"fieldValue": "={{ $('Set Telegram SuperGroupID').item.json.superGroupID }}"
}
]
}
},
"credentials": {
"supabaseApi": {
"id": "LbJH45H5lL5IehHN",
"name": "Supabase account"
}
},
"typeVersion": 1
},
{
"id": "2ddf5eb4-0b5f-43ee-8189-e18bd47a1c96",
"name": "合并",
"type": "n8n-nodes-base.merge",
"position": [
544,
176
],
"parameters": {
"mode": "combine",
"options": {},
"advanced": true,
"joinMode": "={{\n $items(\"Get existing customer details\").length > 0\n ? \"enrichInput1\"\n : \"enrichInput2\"\n}}",
"mergeByFields": {
"values": [
{
"field1": "customerPhone",
"field2": "phone_e164"
}
]
}
},
"typeVersion": 3.2
},
{
"id": "17e0bcb8-f051-4cdd-b11f-7040501d19d3",
"name": "设置 Telegram 超级群组 ID",
"type": "n8n-nodes-base.set",
"position": [
768,
176
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "795e3408-59ba-4960-855c-86e4892780ce",
"name": "superGroupID",
"type": "string",
"value": "-100307123389"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "62ef3a6c-cabd-41d6-a18d-f02b2ab0104b",
"name": "客户详情",
"type": "n8n-nodes-base.set",
"position": [
992,
272
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "352358ab-778a-4ada-af03-1374ca1361ca",
"name": "customerName",
"type": "string",
"value": "={{ $('When Executed by Another Workflow').item.json.customerName }}"
},
{
"id": "c3155a8e-6ca7-4a32-9dc6-35f2e5d42402",
"name": "CustomerPhone",
"type": "string",
"value": "={{ $('When Executed by Another Workflow').item.json.customerPhone }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "7b1cf579-d0f8-4ec9-bf07-6ea5120a2131",
"name": "合并1",
"type": "n8n-nodes-base.merge",
"position": [
1216,
176
],
"parameters": {
"mode": "combine",
"options": {},
"advanced": true,
"joinMode": "={{\n $items(\"Get customer by phone\").length > 0\n ? \"enrichInput1\"\n : \"enrichInput2\"\n}}",
"mergeByFields": {
"values": [
{
"field1": "CustomerPhone",
"field2": "phone_number"
}
]
}
},
"typeVersion": 3.2
},
{
"id": "1cae746d-391d-42b2-bf8e-da11c5a289a0",
"name": "获取现有客户详情",
"type": "n8n-nodes-base.supabase",
"onError": "continueRegularOutput",
"position": [
320,
176
],
"parameters": {
"filters": {
"conditions": [
{
"keyName": "phone_e164",
"keyValue": "={{ $json.customerPhone }}"
},
{
"keyName": "supergroup_id",
"keyValue": "-1003071123489"
}
]
},
"tableId": "wa_tg_threads",
"operation": "get"
},
"credentials": {
"supabaseApi": {
"id": "LbJH45H5lL5IehHN",
"name": "Supabase account"
}
},
"typeVersion": 1
},
{
"id": "d22cdbc2-b216-465c-ad30-c8711cf2cdb7",
"name": "按电话获取客户",
"type": "n8n-nodes-base.supabase",
"onError": "continueRegularOutput",
"position": [
992,
80
],
"parameters": {
"filters": {
"conditions": [
{
"keyName": "phone_number",
"keyValue": "={{ $('When Executed by Another Workflow').item.json.customerPhone }}"
}
]
},
"tableId": "orders",
"operation": "get"
},
"credentials": {
"supabaseApi": {
"id": "LbJH45H5lL5IehHN",
"name": "Supabase account"
}
},
"typeVersion": 1
},
{
"id": "50348b7a-fd87-4454-96c4-c24b48af6d1b",
"name": "设置客户姓名",
"type": "n8n-nodes-base.set",
"position": [
1440,
176
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "e99bc702-7e77-493b-a221-331f8a1f4932",
"name": "CustomerName",
"type": "string",
"value": "={{\n $items(\"Get customer by phone\").length > 0\n ? $items(\"Get customer by phone\")[0].json.customer_name + \" (\" + $items(\"Get customer by phone\")[0].json.phone_number + \")\"\n : $json.customerName + \" (\" + $items(\"Customer Details\")[0].json.CustomerPhone + \")\"\n}}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "8ceacabe-c8ff-4306-91a0-0014949fee9d",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-16,
640
],
"parameters": {
"color": 4,
"width": 1280,
"height": 368,
"content": "## 从 Telegram 发送消息到 WhatsApp"
},
"typeVersion": 1
},
{
"id": "a00575d5-e56e-4f05-8356-4da62a028fb2",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
0,
0
],
"parameters": {
"color": 5,
"width": 2608,
"height": 464,
"content": "## 从 WhatsApp 接收消息到 Telegram"
},
"typeVersion": 1
},
{
"id": "00cef452-8a28-4831-aff7-be28d8ddd5d8",
"name": "WhatsApp 触发器",
"type": "n8n-nodes-base.whatsAppTrigger",
"position": [
96,
176
],
"webhookId": "65cddbc5-d5db-47a5-b193-cac3be0348bc",
"parameters": {
"options": {},
"updates": [
"messages"
]
},
"credentials": {
"whatsAppTriggerApi": {
"id": "0a9ZTj0w0kP1Xoyj",
"name": "Le WhatsApp OAuth account"
}
},
"typeVersion": 1
},
{
"id": "ffce9947-935c-4ea3-998e-7135a108625b",
"name": "发送 Telegram 消息到现有主题",
"type": "n8n-nodes-base.httpRequest",
"position": [
1904,
80
],
"parameters": {
"url": "https://api.telegram.org/bot<your_bot_token>/sendMessage",
"method": "POST",
"options": {},
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "chat_id",
"value": "={{ $('Set Telegram SuperGroupID').item.json.superGroupID }}"
},
{
"name": "message_thread_id",
"value": "={{ $items(\"Get existing customer details\").last().json.telegram_topic_id }}"
},
{
"name": "text",
"value": "={{ $('When Executed by Another Workflow').item.json.customerMessage }}"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "b8b13a10-0514-4599-8735-c8e50af63cf5",
"name": "创建 Telegram 主题",
"type": "n8n-nodes-base.httpRequest",
"position": [
1888,
272
],
"parameters": {
"url": "https://api.telegram.org/bot<your_bot_token>/createForumTopic",
"method": "POST",
"options": {},
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "chat_id",
"value": "={{ $('Set Telegram SuperGroupID').item.json.superGroupID }}"
},
{
"name": "name",
"value": "={{ $('Set Customer Name').item.json.CustomerName }}"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "1ac0695e-5710-4dfe-9003-b7fae01b65b4",
"name": "发送 Telegram 消息到主题",
"type": "n8n-nodes-base.httpRequest",
"position": [
2336,
272
],
"parameters": {
"url": "https://api.telegram.org/bot<your_bot_token>/sendMessage",
"method": "POST",
"options": {},
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "chat_id",
"value": "={{ $('Set Telegram SuperGroupID').item.json.superGroupID }}"
},
{
"name": "message_thread_id",
"value": "={{ $('Create a Telegram Topic').item.json.result.message_thread_id }}"
},
{
"name": "text",
"value": "={{ $('When Executed by Another Workflow').item.json.customerMessage }}"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "928db787-4794-4fb4-babe-8ae9da253e0a",
"name": "检查是否存在现有对话",
"type": "n8n-nodes-base.if",
"position": [
1664,
176
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "528f9f5c-3ac7-4eb2-ad0f-a42416fc79af",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $items('Get existing customer details').length > 0 }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "a56b9ed2-d717-47d9-ac5c-0593e8180ce9",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
1552,
336
],
"parameters": {
"content": "### 从新号码发送 WhatsApp 消息。"
},
"typeVersion": 1
},
{
"id": "41a68c70-b3e7-4b8a-80d6-a0761384a172",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
2064,
16
],
"parameters": {
"height": 224,
"content": "### 从同一号码发送另一条 WhatsApp 消息。"
},
"typeVersion": 1
},
{
"id": "b99d7bef-f367-4f33-8871-c12e8539c42e",
"name": "便签 6",
"type": "n8n-nodes-base.stickyNote",
"position": [
2640,
48
],
"parameters": {
"color": 6,
"width": 672,
"height": 480,
"content": "### 每个客户在您的 Telegram 超级群组中都有专用线程。"
},
"typeVersion": 1
},
{
"id": "dd523151-be07-4ebc-b7db-6a24b16471e6",
"name": "便签4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-32,
928
],
"parameters": {
"width": 304,
"height": 80,
"content": "### 在创建的 Telegram 主题中,以代理身份回复。"
},
"typeVersion": 1
},
{
"id": "ef62abf8-23b7-4462-82b1-a6d2cdcd25e3",
"name": "便签5",
"type": "n8n-nodes-base.stickyNote",
"position": [
896,
928
],
"parameters": {
"width": 320,
"height": 80,
"content": "### 客户将在其 WhatsApp 中收到 Telegram 消息"
},
"typeVersion": 1
},
{
"id": "3db8e878-7d6d-48d1-8ef6-3241a63c9618",
"name": "便签7",
"type": "n8n-nodes-base.stickyNote",
"position": [
2080,
416
],
"parameters": {
"width": 192,
"content": "### 在 supabase 中创建一个表,用于映射电话号码到 telegram 超级群组和消息 threadId"
},
"typeVersion": 1
},
{
"id": "5d9adb1b-10fb-48ca-9bbd-c07d11b0534e",
"name": "便签8",
"type": "n8n-nodes-base.stickyNote",
"position": [
672,
336
],
"parameters": {
"width": 272,
"height": 192,
"content": "## 将此更改为您的 Telegram 超级群组 ID。"
},
"typeVersion": 1
},
{
"id": "da171507-8ee5-426c-a744-eed7876aeed7",
"name": "便签 9",
"type": "n8n-nodes-base.stickyNote",
"position": [
1792,
16
],
"parameters": {
"width": 192,
"height": 96,
"content": "### 在所有 Telegram 请求 URL 中添加您的机器人令牌"
},
"typeVersion": 1
},
{
"id": "fd5a8981-6dd5-4485-a166-756159de5725",
"name": "便利贴 10",
"type": "n8n-nodes-base.stickyNote",
"position": [
2384,
208
],
"parameters": {
"width": 192,
"height": 96,
"content": "### 在 Telegram 请求 URL 中添加您的机器人令牌"
},
"typeVersion": 1
},
{
"id": "614cf902-d6e3-4f82-a70a-65dbb0f8af49",
"name": "便利贴 11",
"type": "n8n-nodes-base.stickyNote",
"position": [
-800,
-368
],
"parameters": {
"width": 720,
"height": 1728,
"content": ""
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "ab07c0c0-17d1-4d5d-83eb-5ec7ecf106e8",
"connections": {
"If": {
"main": [
[
{
"node": "Get a row",
"type": "main",
"index": 0
}
]
]
},
"Merge": {
"main": [
[
{
"node": "Set Telegram SuperGroupID",
"type": "main",
"index": 0
}
]
]
},
"Merge1": {
"main": [
[
{
"node": "Set Customer Name",
"type": "main",
"index": 0
}
]
]
},
"Get a row": {
"main": [
[
{
"node": "Send message",
"type": "main",
"index": 0
}
]
]
},
"Create a row": {
"main": [
[
{
"node": "Send a Telegram message to topic",
"type": "main",
"index": 0
}
]
]
},
"Customer Details": {
"main": [
[
{
"node": "Merge1",
"type": "main",
"index": 1
}
]
]
},
"Telegram Trigger": {
"main": [
[
{
"node": "Filter messages that are replies in topics",
"type": "main",
"index": 0
}
]
]
},
"WhatsApp Trigger": {
"main": [
[
{
"node": "Get existing customer details",
"type": "main",
"index": 0
}
]
]
},
"Set Customer Name": {
"main": [
[
{
"node": "Check existing conversation or not",
"type": "main",
"index": 0
}
]
]
},
"Get customer by phone": {
"main": [
[
{
"node": "Merge1",
"type": "main",
"index": 0
}
]
]
},
"Create a Telegram Topic": {
"main": [
[
{
"node": "Create a row",
"type": "main",
"index": 0
}
]
]
},
"Set Telegram SuperGroupID": {
"main": [
[
{
"node": "Get customer by phone",
"type": "main",
"index": 0
},
{
"node": "Customer Details",
"type": "main",
"index": 0
}
]
]
},
"Get existing customer details": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 0
}
]
]
},
"Check existing conversation or not": {
"main": [
[
{
"node": "Send Telegram Message to existing topic",
"type": "main",
"index": 0
}
],
[
{
"node": "Create a Telegram Topic",
"type": "main",
"index": 0
}
]
]
},
"Filter messages that are replies in topics": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 客服机器人, 杂项, 多模态 AI
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
🚀 面向Shopify品牌的AI驱动WhatsApp客户支持
面向Shopify品牌的AI驱动WhatsApp客户支持(LLM智能体)
Set
Slack
Switch
+11
30 节点Ruthwik
杂项
Zoho Mail中的AI驱动邮件分类与标签
使用GPT-4o-mini在Zoho Mail中自动分类和标记邮件
Set
Code
Merge
+6
17 节点Ruthwik Masina
杂项
带实时状态更新的自动化订单记录器
在Google Sheets中记录电商订单,支持月度分页和状态跟踪
If
Set
Webhook
+3
16 节点Ruthwik Masina
客户关系管理
自动化WhatsApp客户支持,含语音转录、FAQ和预约安排
自动化WhatsApp客户支持,含语音转录、FAQ和预约安排
If
Set
Switch
+11
23 节点AureusR
杂项
Telegram论坛脉搏:使用Gemini和Groq AI模型的社区监控
Telegram论坛脉搏:使用Gemini和Groq AI模型的社区监控
If
Set
Code
+13
59 节点Nguyen Thieu Toan
杂项
餐厅 WhatsApp AI 助手(外卖服务)
餐厅订单与配送系统,基于WhatsApp、GPT-4o和Supabase
If
Set
Code
+13
55 节点Rodrigo
客服机器人