Telegram支持交接自动化
高级
这是一个Support Chatbot, AI Chatbot领域的自动化工作流,包含 40 个节点。主要使用 If, Set, Switch, Telegram, DataTable 等节点。 使用GPT4和邮件提醒自动化Telegram支持从AI到人工的交接
前置要求
- •Telegram Bot Token
- •可能需要目标 API 的认证凭证
- •OpenAI API Key
使用的节点 (40)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"meta": {
"instanceId": "cfcdd4aa7acb600106c0a4bff4e6959e8e3b32b3b8cbc7d93531b2a4c9012a32"
},
"nodes": [
{
"id": "2dabfa67-8f0b-4662-a929-df1e5bb7037e",
"name": "Telegram 触发器",
"type": "n8n-nodes-base.telegramTrigger",
"position": [
16,
448
],
"webhookId": "5e5e14f9-5505-466d-b367-7b724bbc0eb5",
"parameters": {
"updates": [
"message"
],
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "3aAMn4FfzzRDDtfF",
"name": "Loop Template Bot"
}
},
"typeVersion": 1.2
},
{
"id": "b952c1e1-1377-4205-9c92-0702cac12708",
"name": "配置",
"type": "n8n-nodes-base.set",
"position": [
608,
528
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "4439ddcb-8bf4-4f40-8461-02f8ba5795d9",
"name": "user",
"type": "string",
"value": "={{ $('Telegram Trigger').item.json.message.from.id }}"
},
{
"id": "c7c23d1c-8325-485a-82b3-784a45f0c7cc",
"name": "smtp",
"type": "string",
"value": "SMTP_ACCOUNT_MAIL"
},
{
"id": "a20a4051-2916-4072-a156-6cc9efeb18d4",
"name": "operator",
"type": "string",
"value": "OPERATOR_MAIL"
},
{
"id": "b94071df-a56f-4ee7-a260-536924518fcb",
"name": "personal",
"type": "string",
"value": "YOUR_PERSONAL_ID(TELEGRAM)"
},
{
"id": "6e49c76e-3308-4691-8996-a98b4e1fcbd8",
"name": "group",
"type": "string",
"value": "GROUP_ID"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "894b9666-fa3f-485c-8330-4890542c65e2",
"name": "确认操作员",
"type": "n8n-nodes-base.telegram",
"position": [
1680,
480
],
"webhookId": "24b54c8f-858f-4313-84f5-8d7190ccfd3a",
"parameters": {
"chatId": "={{ $('Configuration').item.json.user }}",
"message": "Confirm switching to operator?",
"options": {
"appendAttribution": false
},
"operation": "sendAndWait",
"approvalOptions": {
"values": {
"approvalType": "double"
}
}
},
"credentials": {
"telegramApi": {
"id": "3aAMn4FfzzRDDtfF",
"name": "Loop Template Bot"
}
},
"typeVersion": 1.2
},
{
"id": "d82fb377-0efe-43a7-ae6f-73d577b0e3c9",
"name": "用户已批准",
"type": "n8n-nodes-base.if",
"position": [
1856,
480
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "85d3c27f-d003-4d7c-b0ff-65574db8385c",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $json.data.approved }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "4e9e61ed-ba5c-4450-8ee7-f9ea832ba16d",
"name": "提醒操作员",
"type": "n8n-nodes-base.emailSend",
"position": [
2048,
416
],
"webhookId": "70b1a1dd-4530-4ecb-96d0-f8179cf3e7e6",
"parameters": {
"message": "=User called {{ $('Telegram Trigger').item.json.message.from.username }} has requested an operator in Telegram chat. Please approve this message if the operator will be attending.\n\n**This message will expire in 15 minutes.**\n",
"options": {
"limitWaitTime": {
"values": {
"resumeUnit": "minutes",
"resumeAmount": 15
}
},
"appendAttribution": false
},
"subject": "User Requires Attention",
"toEmail": "={{ $('Configuration').item.json.operator }}",
"fromEmail": "={{ $('Configuration').item.json.smtp }}",
"operation": "sendAndWait",
"approvalOptions": {
"values": {
"approveLabel": "Create Topic"
}
}
},
"credentials": {
"smtp": {
"id": "4DkwbpaAtif3n8IV",
"name": "SMTP MookieLianHD Gmail"
}
},
"typeVersion": 2.1
},
{
"id": "ba253ae3-9c3f-49b9-be17-38c039cf75b6",
"name": "OpenRouter 聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
"position": [
1184,
768
],
"parameters": {
"model": "x-ai/grok-4-fast",
"options": {}
},
"credentials": {
"openRouterApi": {
"id": "d23pUD37RPrT3pC2",
"name": "OpenRouter account"
}
},
"typeVersion": 1
},
{
"id": "3e5cf322-3f81-460e-8d69-8814c518d504",
"name": "操作员已确认",
"type": "n8n-nodes-base.if",
"position": [
2224,
416
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "d06816f2-6906-4167-a7f5-acb348f5678c",
"operator": {
"type": "boolean",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.data.approved }}",
"rightValue": ""
},
{
"id": "524fefa4-f84b-4725-8500-f8ed9b788bd0",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $json.data.approved }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "4bfcbf4e-1b16-4993-8b9a-1711fcda85f1",
"name": "操作员参与",
"type": "n8n-nodes-base.telegram",
"position": [
2416,
336
],
"webhookId": "6952808f-55d4-4766-9448-d1f28e1006b2",
"parameters": {
"text": "Operator will be with you shortly.",
"chatId": "={{ $('Configuration').item.json.user }}",
"additionalFields": {
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"id": "3aAMn4FfzzRDDtfF",
"name": "Loop Template Bot"
}
},
"typeVersion": 1.2
},
{
"id": "111c38e7-f287-4414-9e8c-6040f322ad1a",
"name": "操作员拒绝参与",
"type": "n8n-nodes-base.telegram",
"position": [
2416,
496
],
"webhookId": "6952808f-55d4-4766-9448-d1f28e1006b2",
"parameters": {
"text": "Unfortunately, the operator is not free at the moment.",
"chatId": "={{ $('Configuration').item.json.user }}",
"additionalFields": {
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"id": "3aAMn4FfzzRDDtfF",
"name": "Loop Template Bot"
}
},
"typeVersion": 1.2
},
{
"id": "e48beba6-5267-489a-a929-0f8b019f5919",
"name": "AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
1184,
608
],
"parameters": {
"text": "={{ $('Telegram Trigger').item.json.message.text }}",
"options": {
"systemMessage": "You are a helpful assistant on Telegram platform. To reply to users, call 'Reply to User' tool.\n\n**Critical: Call 'Reply to User' tool once.\n\n**Critical: When users ask to chat with a human agent, reply with 'Human' instead, with no punctuation marks. Do not call the 'Reply To User' tool in this case.**"
},
"promptType": "define",
"needsFallback": true
},
"typeVersion": 2.2
},
{
"id": "8cfdfc0a-893c-4b6c-99df-b3254ad809a4",
"name": "简单记忆",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
1280,
1104
],
"parameters": {
"sessionKey": "={{ $('Configuration').item.json.user }}",
"sessionIdType": "customKey"
},
"typeVersion": 1.3
},
{
"id": "4016ffe6-e825-4f92-95b2-082dec181696",
"name": "回复用户",
"type": "n8n-nodes-base.telegramTool",
"position": [
1328,
800
],
"webhookId": "32b26e29-eae9-48fa-939b-7fc142656da5",
"parameters": {
"text": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Text', `Reply message to be sent to user.`, 'string') }}",
"chatId": "={{ $('Configuration').item.json.user }}",
"additionalFields": {
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"id": "3aAMn4FfzzRDDtfF",
"name": "Loop Template Bot"
}
},
"typeVersion": 1.2
},
{
"id": "a8033517-b6e8-44f9-87d2-2a228f396245",
"name": "人工请求",
"type": "n8n-nodes-base.if",
"position": [
1488,
608
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "2c353a33-ef9c-4ef5-b019-7875e8f80d85",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.output }}",
"rightValue": "Human"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "bfe3aa80-2b10-4dd2-8544-e9456a37d0a0",
"name": "Azure OpenAI 聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatAzureOpenAi",
"position": [
1232,
928
],
"parameters": {
"model": "gpt-4o-mini",
"options": {}
},
"credentials": {
"azureOpenAiApi": {
"id": "4WyMLAYYCsugTVtc",
"name": "Azure Open AI account"
}
},
"typeVersion": 1
},
{
"id": "6dca4f2a-7f5a-49e3-93a2-e3ed0b21b14a",
"name": "更新最后消息",
"type": "n8n-nodes-base.dataTable",
"position": [
2048,
816
],
"parameters": {
"columns": {
"value": {
"type": "ai"
},
"schema": [
{
"id": "type",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "type",
"defaultMatch": false
},
{
"id": "user",
"type": "number",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "user",
"defaultMatch": false
},
{
"id": "topic",
"type": "number",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "topic",
"defaultMatch": false
},
{
"id": "status",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "status",
"defaultMatch": false
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"filters": {
"conditions": [
{
"keyName": "user",
"keyValue": "={{ $('Configuration').item.json.user }}"
}
]
},
"options": {},
"operation": "update",
"dataTableId": {
"__rl": true,
"mode": "list",
"value": "nSoKY9F43bObeGqD",
"cachedResultUrl": "/projects/M1iORETinbUGzqtC/datatables/nSoKY9F43bObeGqD",
"cachedResultName": "Temporary Last Message"
}
},
"typeVersion": 1
},
{
"id": "84786a93-07fe-47ac-96f5-54f4a2c76e83",
"name": "最后消息存在",
"type": "n8n-nodes-base.dataTable",
"position": [
1680,
736
],
"parameters": {
"filters": {
"conditions": [
{
"keyName": "user",
"keyValue": "={{ $('Configuration').item.json.user }}"
},
{
"keyName": "status",
"keyValue": "open"
}
]
},
"operation": "rowExists",
"dataTableId": {
"__rl": true,
"mode": "list",
"value": "nSoKY9F43bObeGqD",
"cachedResultUrl": "/projects/M1iORETinbUGzqtC/datatables/nSoKY9F43bObeGqD",
"cachedResultName": "Temporary Last Message"
}
},
"typeVersion": 1,
"alwaysOutputData": true
},
{
"id": "a27e8718-7b93-4460-9183-c80453158b54",
"name": "行为空",
"type": "n8n-nodes-base.if",
"position": [
1856,
736
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "76c55b53-23a0-4afc-8250-e3d230286d61",
"operator": {
"type": "object",
"operation": "empty",
"singleValue": true
},
"leftValue": "={{ $json }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "539e9e73-006b-4ef0-8dc3-ee3c2bcaf27e",
"name": "创建临时消息",
"type": "n8n-nodes-base.dataTable",
"position": [
2048,
656
],
"parameters": {
"columns": {
"value": {
"type": "ai",
"user": "={{ $('Configuration').item.json.user }}",
"status": "open"
},
"schema": [
{
"id": "type",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "type",
"defaultMatch": false
},
{
"id": "user",
"type": "number",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "user",
"defaultMatch": false
},
{
"id": "topic",
"type": "number",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "topic",
"defaultMatch": false
},
{
"id": "status",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "status",
"defaultMatch": false
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"dataTableId": {
"__rl": true,
"mode": "list",
"value": "nSoKY9F43bObeGqD",
"cachedResultUrl": "/projects/M1iORETinbUGzqtC/datatables/nSoKY9F43bObeGqD",
"cachedResultName": "Temporary Last Message"
}
},
"typeVersion": 1
},
{
"id": "0055bb76-2c3c-49ad-8381-21b951bfa3a0",
"name": "更新临时消息",
"type": "n8n-nodes-base.dataTable",
"position": [
2784,
336
],
"parameters": {
"columns": {
"value": {
"type": "human",
"topic": "={{ $json.result.message_thread_id }}",
"status": "open"
},
"schema": [
{
"id": "type",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "type",
"defaultMatch": false
},
{
"id": "user",
"type": "number",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "user",
"defaultMatch": false
},
{
"id": "topic",
"type": "number",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "topic",
"defaultMatch": false
},
{
"id": "status",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "status",
"defaultMatch": false
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"filters": {
"conditions": [
{
"keyName": "user",
"keyValue": "={{ $('Configuration').item.json.user }}"
}
]
},
"options": {},
"operation": "update",
"dataTableId": {
"__rl": true,
"mode": "list",
"value": "nSoKY9F43bObeGqD",
"cachedResultUrl": "/projects/M1iORETinbUGzqtC/datatables/nSoKY9F43bObeGqD",
"cachedResultName": "Temporary Last Message"
}
},
"typeVersion": 1
},
{
"id": "491171e9-75d7-429b-a280-2d099d9d6ab3",
"name": "获取临时消息",
"type": "n8n-nodes-base.dataTable",
"position": [
784,
528
],
"parameters": {
"filters": {
"conditions": [
{
"keyName": "user",
"keyValue": "={{ $json.user }}"
},
{
"keyName": "status",
"keyValue": "open"
}
]
},
"matchType": "allConditions",
"operation": "get",
"returnAll": true,
"dataTableId": {
"__rl": true,
"mode": "list",
"value": "nSoKY9F43bObeGqD",
"cachedResultUrl": "/projects/M1iORETinbUGzqtC/datatables/nSoKY9F43bObeGqD",
"cachedResultName": "Temporary Last Message"
}
},
"typeVersion": 1,
"alwaysOutputData": true
},
{
"id": "ba334b52-a555-4d95-9eae-a840f5dbfd84",
"name": "消息路由器",
"type": "n8n-nodes-base.switch",
"position": [
976,
512
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "human",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "2d381ff5-c197-4de5-90ab-43e1163d8f74",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.type }}",
"rightValue": "human"
}
]
},
"renameOutput": true
},
{
"outputKey": "empty",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "ca6f18b7-cc9f-4058-b134-f6cb731a0bd6",
"operator": {
"type": "object",
"operation": "empty",
"singleValue": true
},
"leftValue": "={{ $json }}",
"rightValue": ""
}
]
},
"renameOutput": true
},
{
"outputKey": "ai",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "4a69a2ff-9ee3-476d-bef9-b82a7fe673a7",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.type }}",
"rightValue": "ai"
}
]
},
"renameOutput": true
}
]
},
"options": {}
},
"typeVersion": 3.3
},
{
"id": "4183f326-c94f-46ad-a86f-30aee2edcd7e",
"name": "个人",
"type": "n8n-nodes-base.set",
"position": [
3280,
736
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "4439ddcb-8bf4-4f40-8461-02f8ba5795d9",
"name": "personal",
"type": "string",
"value": "={{ $json.message.from.id }}"
},
{
"id": "899b32df-0124-4751-a09b-21e0afa9b3e6",
"name": "group",
"type": "string",
"value": "={{ $json.message.chat.id }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "befed495-26fc-45d4-a8d6-66d6b314b201",
"name": "创建主题",
"type": "n8n-nodes-base.httpRequest",
"position": [
2592,
336
],
"parameters": {
"url": "https://api.telegram.org/botBOT_TOKEN/createForumTopic",
"options": {},
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "chat_id",
"value": "={{ $('Configuration').item.json.group }}"
},
{
"name": "name",
"value": "={{ $('Configuration').item.json.user }}"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "72ce66dd-e1b0-4d97-9b69-1337f8c2d01a",
"name": "文本消息",
"type": "n8n-nodes-base.if",
"position": [
400,
608
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "10537cf3-851f-48c1-94cb-739a47f0cd58",
"operator": {
"type": "string",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.message.text }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "13e7a069-6cdd-485e-bdf9-48e3fd55e19e",
"name": "停止工作流",
"type": "n8n-nodes-base.noOp",
"position": [
608,
688
],
"parameters": {},
"typeVersion": 1
},
{
"id": "b5a3d335-b762-4331-a051-3d75e5258788",
"name": "转发消息到群组",
"type": "n8n-nodes-base.httpRequest",
"position": [
1184,
432
],
"parameters": {
"url": "https://api.telegram.org/botBOT_TOKEN/forwardMessage",
"options": {},
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "chat_id",
"value": "={{ $('Configuration').item.json.group }}"
},
{
"name": "from_chat_id",
"value": "={{ $('Configuration').item.json.user }}"
},
{
"name": "message_id",
"value": "={{ $('Telegram Trigger').item.json.message.message_id }}"
},
{
"name": "message_thread_id",
"value": "={{ $('Get Temporary Message').item.json.topic }}"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "a90da098-55c7-4d79-8cd9-438cdaff33ff",
"name": "主题消息",
"type": "n8n-nodes-base.if",
"position": [
176,
448
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "d5a195e5-5d30-4404-897c-972154ae4776",
"operator": {
"type": "boolean",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.message.is_topic_message }}",
"rightValue": ""
},
{
"id": "1ca6b333-5a2e-4196-98da-ddb9c81a0d74",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $json.message.is_topic_message }}",
"rightValue": ""
},
{
"id": "e07c655e-c4ae-4883-bc15-a39ee6e6dd93",
"operator": {
"type": "string",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.message.text }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "29fe28b7-3973-41ec-b9c4-c04ce6f9496a",
"name": "聊天管理员",
"type": "n8n-nodes-base.httpRequest",
"position": [
3200,
1024
],
"parameters": {
"url": "https://api.telegram.org/botYOUR_TOKEN/getChatAdministrators",
"options": {},
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "chat_id",
"value": "=GROUP_ID"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "e64ca366-4c82-4693-90b0-75e36f2775a3",
"name": "转发消息",
"type": "n8n-nodes-base.httpRequest",
"position": [
608,
368
],
"parameters": {
"url": "https://api.telegram.org/botBOT_TOKEN/forwardMessage",
"options": {},
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "chat_id",
"value": "={{ $('Telegram Trigger').item.json.message.reply_to_message.forum_topic_created.name }}"
},
{
"name": "from_chat_id",
"value": "={{ $('Telegram Trigger').item.json.message.reply_to_message.chat.id }}"
},
{
"name": "message_id",
"value": "={{ $('Telegram Trigger').item.json.message.message_id }}"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "b5f03bf1-d898-4b3b-bbaf-bf7092100420",
"name": "个人触发器",
"type": "n8n-nodes-base.telegramTrigger",
"disabled": true,
"position": [
3136,
736
],
"webhookId": "5e5e14f9-5505-466d-b367-7b724bbc0eb5",
"parameters": {
"updates": [
"message"
],
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "3aAMn4FfzzRDDtfF",
"name": "Loop Template Bot"
}
},
"typeVersion": 1.2
},
{
"id": "ce4fd19f-1ee3-4932-a43c-0838e5f95a4e",
"name": "退出",
"type": "n8n-nodes-base.if",
"position": [
400,
288
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "bc53c1d9-bfee-40f8-8cbf-f78757526fa1",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('Telegram Trigger').item.json.message.text }}",
"rightValue": "exit"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "420d646c-8db9-4c61-9517-42ec946bd4e8",
"name": "关闭主题",
"type": "n8n-nodes-base.httpRequest",
"position": [
608,
192
],
"parameters": {
"url": "https://api.telegram.org/botBOT_TOKEN/closeForumTopic",
"options": {},
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "chat_id",
"value": "={{ $('Telegram Trigger').item.json.message.reply_to_message.chat.id }}"
},
{
"name": "message_thread_id",
"value": "={{ $('Telegram Trigger').item.json.message.reply_to_message.message_thread_id }}"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "ada57ab7-782d-4bcf-8c24-3e68afd8aa37",
"name": "更新已关闭主题",
"type": "n8n-nodes-base.dataTable",
"position": [
784,
192
],
"parameters": {
"columns": {
"value": {
"status": "closed"
},
"schema": [
{
"id": "type",
"type": "string",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "type",
"defaultMatch": false
},
{
"id": "user",
"type": "number",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "user",
"defaultMatch": false
},
{
"id": "topic",
"type": "number",
"display": true,
"removed": true,
"readOnly": false,
"required": false,
"displayName": "topic",
"defaultMatch": false
},
{
"id": "status",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "status",
"defaultMatch": false
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"filters": {
"conditions": [
{
"keyName": "topic",
"keyValue": "={{ $('Telegram Trigger').item.json.message.reply_to_message.message_thread_id }}"
}
]
},
"options": {},
"operation": "update",
"dataTableId": {
"__rl": true,
"mode": "list",
"value": "nSoKY9F43bObeGqD",
"cachedResultUrl": "/projects/M1iORETinbUGzqtC/datatables/nSoKY9F43bObeGqD",
"cachedResultName": "Temporary Last Message"
}
},
"typeVersion": 1
},
{
"id": "120db6ad-faf1-4117-82ab-f878d6bc37dd",
"name": "便签17",
"type": "n8n-nodes-base.stickyNote",
"position": [
2336,
1200
],
"parameters": {
"color": 5,
"width": 1680,
"height": 80,
"content": "# 凭据"
},
"typeVersion": 1
},
{
"id": "7dca3dc6-3735-49c6-85fd-10b4a4f3326b",
"name": "便签18",
"type": "n8n-nodes-base.stickyNote",
"position": [
2976,
272
],
"parameters": {
"color": 6,
"width": 560,
"height": 928,
"content": "## Telegram - [文档](https://docs.n8n.io/integrations/builtin/credentials/telegram/)"
},
"typeVersion": 1
},
{
"id": "9c27036e-b7eb-4e71-86ef-cbfbd93ae9ff",
"name": "便签19",
"type": "n8n-nodes-base.stickyNote",
"position": [
3568,
432
],
"parameters": {
"color": 6,
"width": 448,
"height": 768,
"content": "## 配置节点"
},
"typeVersion": 1
},
{
"id": "9543d11d-2d11-4785-8534-d952c5952f57",
"name": "便签20",
"type": "n8n-nodes-base.stickyNote",
"position": [
2336,
752
],
"parameters": {
"color": 6,
"width": 592,
"height": 448,
"content": "## 数据表 - n8n"
},
"typeVersion": 1
},
{
"id": "0b52da6c-a05e-4b00-b981-01a4d61a2b68",
"name": "便签21",
"type": "n8n-nodes-base.stickyNote",
"position": [
576,
960
],
"parameters": {
"color": 4,
"width": 560,
"height": 384,
"content": "# 概览视频 - 1 分钟"
},
"typeVersion": 1
},
{
"id": "4478a416-f352-4f2b-924c-95a2cbdf18ca",
"name": "便签22",
"type": "n8n-nodes-base.stickyNote",
"position": [
0,
912
],
"parameters": {
"color": 4,
"width": 560,
"height": 432,
"content": "# 详细设置视频 - 10 分钟"
},
"typeVersion": 1
},
{
"id": "55172322-f2fe-4245-996e-254ddfcef702",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-624,
192
],
"parameters": {
"color": 5,
"width": 576,
"height": 1152,
"content": "# 欢迎"
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"Exit": {
"main": [
[
{
"node": "Close Topic",
"type": "main",
"index": 0
}
],
[
{
"node": "Forward Message",
"type": "main",
"index": 0
}
]
]
},
"AI Agent": {
"main": [
[
{
"node": "Human Requested",
"type": "main",
"index": 0
}
]
]
},
"Close Topic": {
"main": [
[
{
"node": "Update Closed Topic",
"type": "main",
"index": 0
}
]
]
},
"Create Topic": {
"main": [
[
{
"node": "Update Temporary Message",
"type": "main",
"index": 0
}
]
]
},
"Row is Empty": {
"main": [
[
{
"node": "Create Temporary Message",
"type": "main",
"index": 0
}
],
[
{
"node": "Update Last Message",
"type": "main",
"index": 0
}
]
]
},
"Text Message": {
"main": [
[
{
"node": "Configuration",
"type": "main",
"index": 0
}
],
[
{
"node": "Stop Workflow",
"type": "main",
"index": 0
}
]
]
},
"Configuration": {
"main": [
[
{
"node": "Get Temporary Message",
"type": "main",
"index": 0
}
]
]
},
"Reply To User": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Simple Memory": {
"ai_memory": [
[
{
"node": "AI Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"Topic Message": {
"main": [
[
{
"node": "Exit",
"type": "main",
"index": 0
}
],
[
{
"node": "Text Message",
"type": "main",
"index": 0
}
]
]
},
"User Approved": {
"main": [
[
{
"node": "Alert Operator",
"type": "main",
"index": 0
}
],
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"Alert Operator": {
"main": [
[
{
"node": "Operator Confirmed",
"type": "main",
"index": 0
}
]
]
},
"Message Router": {
"main": [
[
{
"node": "Forward Message To Group",
"type": "main",
"index": 0
}
],
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
],
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"Human Requested": {
"main": [
[
{
"node": "Confirm Operator",
"type": "main",
"index": 0
}
],
[
{
"node": "Last Message Exists",
"type": "main",
"index": 0
}
]
]
},
"Confirm Operator": {
"main": [
[
{
"node": "User Approved",
"type": "main",
"index": 0
}
]
]
},
"Personal Trigger": {
"main": [
[
{
"node": "Personal",
"type": "main",
"index": 0
}
]
]
},
"Telegram Trigger": {
"main": [
[
{
"node": "Topic Message",
"type": "main",
"index": 0
}
]
]
},
"Operator Confirmed": {
"main": [
[
{
"node": "Operator Attendance",
"type": "main",
"index": 0
}
],
[
{
"node": "Operator Declined Attendance",
"type": "main",
"index": 0
}
]
]
},
"Last Message Exists": {
"main": [
[
{
"node": "Row is Empty",
"type": "main",
"index": 0
}
]
]
},
"Operator Attendance": {
"main": [
[
{
"node": "Create Topic",
"type": "main",
"index": 0
}
]
]
},
"Get Temporary Message": {
"main": [
[
{
"node": "Message Router",
"type": "main",
"index": 0
}
]
]
},
"OpenRouter Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Azure OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 1
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 客服机器人, AI 聊天机器人
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
多语言语音文本Telegram机器人(ElevenLabs TTS与LangChain代理)
集成ElevenLabs语音合成与LangChain代理的多语言语音文本Telegram机器人
If
Set
Switch
+10
18 节点IvanCore
客服机器人
使用Azure OpenAI和Google表格分类邮件并获取Telegram提醒
使用Azure OpenAI和Google表格分类邮件并获取Telegram提醒
If
Set
Telegram
+11
27 节点Meelioo
工单管理
演示邮件分享
通过AI、Telegram机器人和网站爬取创建个性化邮件外联
If
Set
Xml
+20
58 节点Michael A Putra
客户培育
J.A.R.V.I.S.
在Telegram上使用OpenAI、SERP和向量存储构建全面的多模态助手
If
Set
Code
+16
48 节点FabioInTech
客服机器人
使用GPT-4o分析和Google Sheets监控Reddit招聘帖子并发送Telegram警报
使用GPT-4o分析和Google Sheets监控Reddit招聘帖子并发送Telegram警报
If
Set
Code
+10
28 节点Meelioo
AI 摘要总结
多模态支出追踪 - GPT-4、Gemini OCR与Telegram语音
集成GPT-4、Gemini OCR和Telegram语音的多模态支出追踪系统
If
Set
Switch
+13
33 节点Oussama
AI 聊天机器人