Telegram消息处理自动化
高级
这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 17 个节点。主要使用 Set, Switch, SplitOut, Telegram, TelegramTrigger 等节点。 自动化Telegram消息处理 - 分离文本和文件
前置要求
- •Telegram Bot Token
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"meta": {
"instanceId": "cd9bb7894b11bab249a60976239056d06e4831b51d7348f6790a85241c21fc56"
},
"nodes": [
{
"id": "6e742911-e7c0-47bc-b2f9-99789571617a",
"name": "等待消息",
"type": "n8n-nodes-base.telegramTrigger",
"position": [
-480,
-64
],
"webhookId": "3d811399-b5e2-4c6c-833d-9c7c0b0ce4c6",
"parameters": {
"updates": [
"message"
],
"additionalFields": {
"download": false
}
},
"credentials": {
"telegramApi": {
"id": "KDZRFnPXPuAVravz",
"name": "Template"
}
},
"typeVersion": 1.2
},
{
"id": "2d2c3f99-2df5-4971-bb9f-cfd5d20fa615",
"name": "仅获取聊天消息",
"type": "n8n-nodes-base.set",
"position": [
-32,
128
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "d1590916-031f-4cc6-b6ce-7b1721a53a30",
"name": "text",
"type": "string",
"value": ""
}
]
}
},
"typeVersion": 3.4
},
{
"id": "f06208a9-b6d8-4af1-9cc6-bb68f580df29",
"name": "Google Calendar MCP",
"type": "n8n-nodes-base.switch",
"position": [
-288,
-80
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "Attachmet+Message(Caption)",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "1c36bdfd-7a9a-4f5d-bd53-12ffc8c8f829",
"operator": {
"type": "string",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.message.caption }}",
"rightValue": ""
}
]
},
"renameOutput": true
},
{
"outputKey": "Attachment Only",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "a0080ad2-7885-4485-ae57-0c4dea199483",
"operator": {
"type": "object",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.message.document }}",
"rightValue": ""
}
]
},
"renameOutput": true
},
{
"outputKey": "Message Only",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "dd9f3c11-ba4b-4963-bc02-23cd7670bf94",
"operator": {
"type": "string",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.message.text }}",
"rightValue": ""
}
]
},
"renameOutput": true
}
]
},
"options": {}
},
"typeVersion": 3.2
},
{
"id": "74a133e1-f969-4fb9-8661-c323279fca27",
"name": "拆分输出",
"type": "n8n-nodes-base.splitOut",
"position": [
-32,
-256
],
"parameters": {
"options": {},
"fieldToSplitOut": "message.document.file_id, message.document.file_name, message.caption"
},
"typeVersion": 1
},
{
"id": "344226d7-fc3f-4170-ada7-6300c31b3f0d",
"name": "仅获取附件",
"type": "n8n-nodes-base.set",
"position": [
-32,
-64
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "41cf616c-c640-4f61-a2ba-49715aa1bf2a",
"name": "file_id",
"type": "string",
"value": "={{$json.message.document.file_id}}"
},
{
"id": "22fcf53f-ebd5-4294-9fd8-7a485b8293f2",
"name": "file_name",
"type": "string",
"value": "={{$json.message.document.file_name}}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "0dbedca1-1b6d-47ab-8374-1a094d055962",
"name": "获取并下载附件",
"type": "n8n-nodes-base.telegram",
"position": [
208,
-64
],
"webhookId": "d73ca4c3-e657-4205-9443-59c111c5cb5f",
"parameters": {
"fileId": "={{ $json.file_id || $json.message.document.file_id }}",
"resource": "file",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "KDZRFnPXPuAVravz",
"name": "Template"
}
},
"typeVersion": 1.2
},
{
"id": "ed661779-1132-43e3-98bb-60933169e8ec",
"name": "获取附件",
"type": "n8n-nodes-base.set",
"position": [
208,
-256
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "41cf616c-c640-4f61-a2ba-49715aa1bf2a",
"name": "file_id",
"type": "string",
"value": "={{ $json['message.document.file_id'] }}"
},
{
"id": "22fcf53f-ebd5-4294-9fd8-7a485b8293f2",
"name": "file_name",
"type": "string",
"value": "={{ $json['message.document.file_name'] }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "4ae82bee-86f6-424c-857e-bd04f213d9f7",
"name": "下一步!",
"type": "n8n-nodes-base.noOp",
"position": [
416,
-448
],
"parameters": {},
"typeVersion": 1
},
{
"id": "d478957b-8d4f-4c85-8684-9be3311a59f7",
"name": "下一步!",
"type": "n8n-nodes-base.noOp",
"position": [
416,
-64
],
"parameters": {},
"typeVersion": 1
},
{
"id": "cb0d1d8d-2c9b-48f2-af3d-3eab61173d3d",
"name": "下一步!",
"type": "n8n-nodes-base.noOp",
"position": [
208,
128
],
"parameters": {},
"typeVersion": 1
},
{
"id": "3717aff4-90a4-4d7d-936a-d0dd4ad2e7e8",
"name": "获取聊天消息内容",
"type": "n8n-nodes-base.set",
"position": [
208,
-448
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "8de49002-38ba-43fe-ba48-18e8c85241a2",
"name": "chat_message_content",
"type": "string",
"value": "={{ $json['message.caption'] }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "ee320c2a-da1d-46e7-b0de-325a9f398478",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-560,
-768
],
"parameters": {
"width": 1184,
"height": 1072,
"content": "## 💬 **Telegram 消息解析器 - 分离文本和文件** ᯓ➤"
},
"typeVersion": 1
},
{
"id": "cce8c746-8dcd-4919-8bc1-e532ad7aeda7",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
640,
-768
],
"parameters": {
"width": 592,
"height": 576,
"content": "## 🔄 **工作流流程说明**"
},
"typeVersion": 1
},
{
"id": "fcf591be-4432-44f7-b148-38dcab66dfa3",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-560,
320
],
"parameters": {
"width": 1184,
"height": 288,
"content": "## 🙏 **感谢您试用此工作流**"
},
"typeVersion": 1
},
{
"id": "4bfb1059-f967-4fe5-bc3a-f43c782fc6ca",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1168,
-768
],
"parameters": {
"width": 592,
"height": 352,
"content": "## 🛠️ **自定义选项**"
},
"typeVersion": 1
},
{
"id": "f38bb91a-5374-42c5-bb66-c784a56cb7b2",
"name": "便签说明4",
"type": "n8n-nodes-base.stickyNote",
"position": [
640,
-176
],
"parameters": {
"width": 592,
"height": 480,
"content": "## 🩺 **故障排除**"
},
"typeVersion": 1
},
{
"id": "59547980-fcab-4962-aa1a-5a968f6765c0",
"name": "便签说明5",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1168,
-400
],
"parameters": {
"width": 592,
"height": 784,
"content": "## 🔧 **分步设置指南**"
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"Switch": {
"main": [
[
{
"node": "Split Out",
"type": "main",
"index": 0
}
],
[
{
"node": "Get Attachment Only",
"type": "main",
"index": 0
}
],
[
{
"node": "Get Chat Message Only",
"type": "main",
"index": 0
}
]
]
},
"Split Out": {
"main": [
[
{
"node": "Get Chat Message Content",
"type": "main",
"index": 0
},
{
"node": "Get Attachment",
"type": "main",
"index": 0
}
]
]
},
"Get Attachment": {
"main": [
[
{
"node": "Get & Download Attachment",
"type": "main",
"index": 0
}
]
]
},
"Get Attachment Only": {
"main": [
[
{
"node": "Get & Download Attachment",
"type": "main",
"index": 0
}
]
]
},
"Waiting For Message": {
"main": [
[
{
"node": "Switch",
"type": "main",
"index": 0
}
]
]
},
"Get Chat Message Only": {
"main": [
[
{
"node": "Next Step ! ",
"type": "main",
"index": 0
}
]
]
},
"Get Chat Message Content": {
"main": [
[
{
"node": "Next Step !",
"type": "main",
"index": 0
}
]
]
},
"Get & Download Attachment": {
"main": [
[
{
"node": "Next Step ! ",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 内容创作, 多模态 AI
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
完整的 B2B 销售流程:Apollo 潜在客户生成、Mailgun 外展和 AI 回复管理
完整的 B2B 销售流程:Apollo 潜在客户生成、Mailgun 外展和 AI 回复管理
If
Set
Code
+26
116 节点Paul
内容创作
从产品图片生成 UGC 视频(Gemini 和 VEO3)
使用 Gemini 和 VEO3 从产品图片生成 UGC 视频
Set
Code
Wait
+12
32 节点Growth AI
内容创作
Telegram AI代理基础模板
基于Claude和Gemini支持语音、图像和视频分析的多模态Telegram机器人
Set
Merge
Switch
+10
31 节点Keith Uy
内容创作
使用OpenAI Whisper和Gemini将Telegram内容转换为多平台帖子
使用OpenAI Whisper和Gemini将Telegram内容转换为多平台帖子
If
Set
Switch
+10
63 节点Juan Carlos Cavero Gracia
内容创作
从Google Drive提取并格式化PDF数据
从Google Drive提取并格式化PDF数据
Set
Code
Google Drive
+4
15 节点EoCi - Mr.Eo
内容创作
Telegram AI歌词学习机器人 — 翻译、摘要、词汇
Telegram AI歌词学习机器人 — 翻译、摘要、词汇
If
Set
Code
+7
30 节点Raphael De Carvalho Florencio
内容创作