转录-Telegram-模板
高级
这是一个Document Extraction, Multimodal AI领域的自动化工作流,包含 33 个节点。主要使用 If, Set, Code, Switch, Telegram 等节点。 使用 Whisper 和 Gemini 转录 Telegram 语音消息,含备用机制
前置要求
- •Telegram Bot Token
- •OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "VSZa9w1RI0u5BNbS",
"meta": {
"instanceId": "abeb4de6795125f40ad5de96d2a952a3dd8b9999a00fda0c983edb96a5a49cc6",
"templateCredsSetupCompleted": true
},
"name": "转录-Telegram-模板",
"tags": [],
"nodes": [
{
"id": "b5b09a51-d67f-4ce9-9d68-f7a7a7e5b740",
"name": "Telegram 触发器1",
"type": "n8n-nodes-base.telegramTrigger",
"position": [
-1536,
80
],
"webhookId": "0a9f1937-94e7-414a-9423-4a13f13a9d55",
"parameters": {
"updates": [
"message"
],
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "HJQKfpYJoO6wuDRR",
"name": "Test"
}
},
"typeVersion": 1.2
},
{
"id": "8c61835a-5026-45f8-95f0-31283f399ae8",
"name": "消息 - 开始转录。请稍候。",
"type": "n8n-nodes-base.telegram",
"position": [
48,
-288
],
"webhookId": "2e248958-2d66-43b6-8d1a-e0e70ed48d1f",
"parameters": {
"text": "Starting transcription. Please wait.",
"chatId": "={{ $('Telegram Trigger1').item.json.message.chat.id }}",
"additionalFields": {
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"id": "HJQKfpYJoO6wuDRR",
"name": "Test"
}
},
"typeVersion": 1.2
},
{
"id": "ef8b3ab0-8aa2-4b3f-bd13-a574d486e05f",
"name": "消息 - 访问被拒绝!",
"type": "n8n-nodes-base.telegram",
"position": [
-1152,
352
],
"webhookId": "e828b75b-3f44-4493-8255-d9df3f75684f",
"parameters": {
"text": "Access denied!",
"chatId": "={{ $('Telegram Trigger1').item.json.message.chat.id }}",
"additionalFields": {
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"id": "HJQKfpYJoO6wuDRR",
"name": "Test"
}
},
"typeVersion": 1.2
},
{
"id": "c6b800a7-98cd-4a69-9752-2bd81ca1ff6f",
"name": "消息 - 无文件!",
"type": "n8n-nodes-base.telegram",
"position": [
-768,
352
],
"webhookId": "2040825e-7ae5-46d5-9dc8-55fc8f1b864e",
"parameters": {
"text": "No file!",
"chatId": "={{ $('Telegram Trigger1').item.json.message.chat.id }}",
"additionalFields": {
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"id": "HJQKfpYJoO6wuDRR",
"name": "Test"
}
},
"typeVersion": 1.2
},
{
"id": "7291c581-6478-4911-a440-538bace43595",
"name": "获取文件 GPT",
"type": "n8n-nodes-base.telegram",
"position": [
-224,
-80
],
"webhookId": "1ed2ed8a-f8fe-4960-8da7-523b0603f172",
"parameters": {
"fileId": "={{ $json.file_id }}",
"resource": "file",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "HJQKfpYJoO6wuDRR",
"name": "Test"
}
},
"typeVersion": 1.2,
"alwaysOutputData": false
},
{
"id": "39256ede-db0e-4e8a-8f38-746dd6c64810",
"name": "获取文件 Gemini",
"type": "n8n-nodes-base.telegram",
"position": [
192,
192
],
"webhookId": "03966b0b-973f-40c7-b110-ed803ce6605e",
"parameters": {
"fileId": "={{ $('Get File GPT').item.json.result.file_id }}",
"resource": "file",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "HJQKfpYJoO6wuDRR",
"name": "Test"
}
},
"typeVersion": 1.2,
"alwaysOutputData": false
},
{
"id": "3a259e3c-d7a4-41fc-9d4a-a7fef83ce477",
"name": "消息 - 文件无法识别",
"type": "n8n-nodes-base.telegram",
"position": [
-240,
352
],
"webhookId": "32096d61-d73f-4819-898a-02b68e50d133",
"parameters": {
"text": "File not recognized",
"chatId": "={{ $('Telegram Trigger1').item.json.message.chat.id }}",
"additionalFields": {
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"id": "HJQKfpYJoO6wuDRR",
"name": "Test"
}
},
"typeVersion": 1.2
},
{
"id": "0b3d30b7-3ae9-4aa5-af74-efb25fe33e0a",
"name": "消息 - 输出",
"type": "n8n-nodes-base.telegram",
"position": [
896,
-192
],
"webhookId": "7e85bc7a-bb0c-4da5-bbaf-3a5db1c7b4ee",
"parameters": {
"text": "={{ $json.text }}",
"chatId": "={{ $('Telegram Trigger1').item.json.message.chat.id }}",
"additionalFields": {
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"id": "HJQKfpYJoO6wuDRR",
"name": "Test"
}
},
"typeVersion": 1.2
},
{
"id": "95019c94-e034-4ef2-bdf4-5c6f906a8309",
"name": "消息 - 分块输出",
"type": "n8n-nodes-base.telegram",
"position": [
1216,
208
],
"webhookId": "7c996c0a-9b70-4391-b877-a68f9342353d",
"parameters": {
"text": "={{ $json.body }}",
"chatId": "={{ $('Telegram Trigger1').item.json.message.chat.id }}",
"additionalFields": {
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"id": "HJQKfpYJoO6wuDRR",
"name": "Test"
}
},
"typeVersion": 1.2
},
{
"id": "7f5d77be-0300-4927-ac47-9da660bc73fb",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1344,
-64
],
"parameters": {
"width": 352,
"height": 352,
"content": "## 访问权限"
},
"typeVersion": 1
},
{
"id": "e1294272-66fe-4003-aa08-b000d8bd92cf",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-960,
-64
],
"parameters": {
"width": 464,
"height": 352,
"content": "## 记录类型识别"
},
"typeVersion": 1
},
{
"id": "33e9e4c1-b194-4985-ac68-dde11002b5d8",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-480,
304
],
"parameters": {
"width": 464,
"height": 192,
"content": "## 文件无法识别消息"
},
"typeVersion": 1
},
{
"id": "f80bbb05-c782-484f-8998-dfe4acf78fbe",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-960,
304
],
"parameters": {
"width": 464,
"height": 192,
"content": "## 文件未找到消息"
},
"typeVersion": 1
},
{
"id": "7a86366b-fd42-42ee-bbb6-b30126b292bc",
"name": "便签4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1344,
304
],
"parameters": {
"width": 352,
"height": 192,
"content": "## 访问被拒绝消息"
},
"typeVersion": 1
},
{
"id": "52ea9f97-e3f1-42f7-a472-8a8e3001e254",
"name": "便签5",
"type": "n8n-nodes-base.stickyNote",
"position": [
-288,
-176
],
"parameters": {
"height": 240,
"content": "## 获取用于 GPT 转录的文件"
},
"typeVersion": 1
},
{
"id": "97c746b5-93ff-44dc-b4dd-f4cd8f7cf4d1",
"name": "便签6",
"type": "n8n-nodes-base.stickyNote",
"position": [
-16,
-400
],
"parameters": {
"height": 272,
"content": "## 工作开始通知"
},
"typeVersion": 1
},
{
"id": "d0e8341f-c82d-40b9-a2bb-7676b98a3cb7",
"name": "便签7",
"type": "n8n-nodes-base.stickyNote",
"position": [
176,
64
],
"parameters": {
"width": 432,
"height": 304,
"content": "## 如果通过 GPT 转录失败,我们开始通过 Gemini 进行转录"
},
"typeVersion": 1
},
{
"id": "8ac65c15-9774-4d5a-8f99-903e00698311",
"name": "便签8",
"type": "n8n-nodes-base.stickyNote",
"position": [
816,
-320
],
"parameters": {
"width": 272,
"height": 288,
"content": "## 如果文本少于 4000 个字符,则发送结果"
},
"typeVersion": 1
},
{
"id": "9eff7515-a915-4a37-82c3-7b77011e3671",
"name": "便签9",
"type": "n8n-nodes-base.stickyNote",
"position": [
816,
48
],
"parameters": {
"width": 288,
"height": 320,
"content": "## 如果文本超过 4000 个字符,我们将其分割成多个部分"
},
"typeVersion": 1
},
{
"id": "dd08756a-fe21-4b32-a84d-4658d302f02f",
"name": "便签10",
"type": "n8n-nodes-base.stickyNote",
"position": [
1152,
48
],
"parameters": {
"width": 288,
"height": 320,
"content": "## 发送消息片段"
},
"typeVersion": 1
},
{
"id": "6619e9f6-a42a-4efc-af5d-3778be5b3541",
"name": "便签12",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2256,
-144
],
"parameters": {
"color": 2,
"width": 640,
"height": 640,
"content": "## 描述"
},
"typeVersion": 1
},
{
"id": "84de2b59-5476-4350-8377-060ec83c4b2b",
"name": "便签13",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2256,
-592
],
"parameters": {
"color": 2,
"width": 640,
"height": 416,
"content": "## [视频教程](https://youtu.be/ckXszQCkncM)"
},
"typeVersion": 1
},
{
"id": "3b36c7c4-ac75-4156-84ac-07a8133b9d97",
"name": "访问检查",
"type": "n8n-nodes-base.if",
"position": [
-1328,
80
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "or",
"conditions": [
{
"id": "4a6f724e-00ca-4e3a-9348-ca0c4485a6cb",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.message.from.username }}",
"rightValue": "User 2"
},
{
"id": "3eb097c7-37bb-40ee-9c9a-faec6ec296ef",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.message.from.username }}",
"rightValue": "User 1"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "8a7fb6d8-7264-44db-a7f7-3515920ef859",
"name": "确定文档类型",
"type": "n8n-nodes-base.switch",
"position": [
-944,
48
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "Voice",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "27b41a26-b098-41a6-84a4-298c272f2aac",
"operator": {
"type": "object",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.message.voice }}",
"rightValue": ""
}
]
},
"renameOutput": true
},
{
"outputKey": "Audio",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "53e7b9a8-f6df-483e-94d5-9bcff0605057",
"operator": {
"type": "object",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.message.audio }}",
"rightValue": ""
}
]
},
"renameOutput": true
}
]
},
"options": {
"fallbackOutput": "extra"
}
},
"typeVersion": 3.2,
"alwaysOutputData": false
},
{
"id": "db156b5f-0947-4d61-b41d-46df405dddf7",
"name": "为语音分配文件ID",
"type": "n8n-nodes-base.set",
"position": [
-656,
-16
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "cff9b35a-94c1-49cd-82d3-1aa99784ecf4",
"name": "file_id",
"type": "string",
"value": "={{ $json.message.voice.file_id }}"
}
]
},
"includeOtherFields": true
},
"typeVersion": 3.4
},
{
"id": "c1e997b9-7b90-4a6a-9c12-4a79c56b6781",
"name": "为音频分配文件ID",
"type": "n8n-nodes-base.set",
"position": [
-656,
160
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "cff9b35a-94c1-49cd-82d3-1aa99784ecf4",
"name": "file_id",
"type": "string",
"value": "={{ $json.message.audio.file_id }}"
}
]
},
"includeOtherFields": true
},
"typeVersion": 3.4
},
{
"id": "607d8c2a-692b-492d-a465-9b7570b6a403",
"name": "转录决策节点",
"type": "n8n-nodes-base.if",
"position": [
-464,
64
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "or",
"conditions": [
{
"id": "efcf6a8d-cfc5-4e38-bbfc-87054a07b7d2",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('Telegram Trigger1').item.json.message.voice.mime_type }}",
"rightValue": "audio/ogg"
},
{
"id": "358d4782-b3cb-4695-b9ad-b28ec7e0517b",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('Telegram Trigger1').item.json.message.voice.mime_type }}",
"rightValue": "audio/mpeg"
},
{
"id": "c550c35e-0058-4e0b-bb36-579ad814362a",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('Telegram Trigger1').item.json.message.audio.mime_type }}",
"rightValue": "audio/mpeg"
},
{
"id": "abca7dbd-0f40-4d83-a8d4-491ccc983701",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('Telegram Trigger1').item.json.message.audio.mime_type }}",
"rightValue": "audio/mp4"
},
{
"id": "07cec6d3-b276-4a77-89b3-0e4ffc005e3a",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('Telegram Trigger1').item.json.message.audio.mime_type }}",
"rightValue": "audio/m4a"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "3b947ce9-4c2b-402e-87c5-7fd2c5095dcf",
"name": "通过 OpenAi 转录",
"type": "@n8n/n8n-nodes-langchain.openAi",
"onError": "continueErrorOutput",
"position": [
32,
-80
],
"parameters": {
"options": {},
"resource": "audio",
"operation": "transcribe"
},
"credentials": {
"openAiApi": {
"id": "mILSsq03xGUAjYqe",
"name": "Test"
}
},
"typeVersion": 1.8,
"alwaysOutputData": false
},
{
"id": "7a1053ad-f073-432d-994f-dc2962b88527",
"name": "通过 Gemini 转录",
"type": "@n8n/n8n-nodes-langchain.googleGemini",
"position": [
352,
192
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "models/gemini-2.5-flash",
"cachedResultName": "models/gemini-2.5-flash"
},
"options": {},
"resource": "audio",
"inputType": "binary",
"binaryPropertyName": "=data"
},
"credentials": {
"googlePalmApi": {
"id": "4fkTqSVMFBOr1i2z",
"name": "Test"
}
},
"typeVersion": 1
},
{
"id": "3db744c6-ffd5-4950-9e8e-14d1a156f7ff",
"name": "变量 TEXT 赋值",
"type": "n8n-nodes-base.set",
"position": [
496,
-96
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "a38b0a02-febd-4fbb-a43c-cf88a3ec52ee",
"name": "text",
"type": "string",
"value": "={{ $json.text }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "62dca117-1c3a-4ca8-90e9-42c958385dd8",
"name": "变量 TEXT1 赋值",
"type": "n8n-nodes-base.set",
"position": [
496,
192
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "a38b0a02-febd-4fbb-a43c-cf88a3ec52ee",
"name": "text",
"type": "string",
"value": "={{ $json.content.parts[0].text }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "14e4417b-77fd-461b-9802-0b3b82769138",
"name": "检查消息长度",
"type": "n8n-nodes-base.if",
"position": [
672,
16
],
"parameters": {
"options": {
"ignoreCase": false
},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "1ea96016-10c2-4acd-8998-f059de847ff9",
"operator": {
"type": "number",
"operation": "lt"
},
"leftValue": "={{ $json[\"text\"].length }}",
"rightValue": 4000
}
]
}
},
"typeVersion": 2.2
},
{
"id": "e42cece4-79d1-47fb-90b7-d863d42801da",
"name": "文本分割",
"type": "n8n-nodes-base.code",
"position": [
880,
208
],
"parameters": {
"jsCode": "const input = $json[\"text\"]; // або де твій текст\nconst chunkSize = 4000;\n\nconst chunks = [];\nfor (let i = 0; i < input.length; i += chunkSize) {\n chunks.push({ body: input.substring(i, i + chunkSize) });\n}\n\nreturn chunks.map(chunk => ({\n json: chunk\n}));\n"
},
"typeVersion": 2
}
],
"active": false,
"pinData": {},
"settings": {
"callerPolicy": "workflowsFromSameOwner",
"errorWorkflow": "x9AXxSMhwpuoJ3Qy",
"executionOrder": "v1"
},
"versionId": "2c1b61ca-a3e1-47db-af95-959aaf4857a2",
"connections": {
"Access Check": {
"main": [
[
{
"node": "Determining The Type Of Document",
"type": "main",
"index": 0
}
],
[
{
"node": "MSG - Access denied!",
"type": "main",
"index": 0
}
]
]
},
"Get File GPT": {
"main": [
[
{
"node": "Transcription by OpenAi",
"type": "main",
"index": 0
},
{
"node": "MSG - Starting transcription. Please wait.",
"type": "main",
"index": 0
}
]
]
},
"Text Division": {
"main": [
[
{
"node": "MSG - Output with chunking",
"type": "main",
"index": 0
}
]
]
},
"Get File Gemini": {
"main": [
[
{
"node": "Transcription by Gemini",
"type": "main",
"index": 0
}
]
]
},
"Telegram Trigger1": {
"main": [
[
{
"node": "Access Check",
"type": "main",
"index": 0
}
]
]
},
"Transcription by Gemini": {
"main": [
[
{
"node": "Assignment of variable TEXT1",
"type": "main",
"index": 0
}
]
]
},
"Transcription by OpenAi": {
"main": [
[
{
"node": "Assignment of variable TEXT",
"type": "main",
"index": 0
}
],
[
{
"node": "Get File Gemini",
"type": "main",
"index": 0
}
]
]
},
"Assigning file_id For Audio": {
"main": [
[
{
"node": "Transcription Decision Node",
"type": "main",
"index": 0
}
]
]
},
"Assigning file_id For Voice": {
"main": [
[
{
"node": "Transcription Decision Node",
"type": "main",
"index": 0
}
]
]
},
"Assignment of variable TEXT": {
"main": [
[
{
"node": "Checking the length of a message",
"type": "main",
"index": 0
}
]
]
},
"Transcription Decision Node": {
"main": [
[
{
"node": "Get File GPT",
"type": "main",
"index": 0
}
],
[
{
"node": "MSG - File not recognized",
"type": "main",
"index": 0
}
]
]
},
"Assignment of variable TEXT1": {
"main": [
[
{
"node": "Checking the length of a message",
"type": "main",
"index": 0
}
]
]
},
"Checking the length of a message": {
"main": [
[
{
"node": "MSG - Output",
"type": "main",
"index": 0
}
],
[
{
"node": "Text Division",
"type": "main",
"index": 0
}
]
]
},
"Determining The Type Of Document": {
"main": [
[
{
"node": "Assigning file_id For Voice",
"type": "main",
"index": 0
}
],
[
{
"node": "Assigning file_id For Audio",
"type": "main",
"index": 0
}
],
[
{
"node": "MSG - No file!",
"type": "main",
"index": 0
}
]
]
},
"MSG - Starting transcription. Please wait.": {
"main": [
[]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 文档提取, 多模态 AI
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
带有 Chatgpt Agent Prompt 检查的信用卡
AI驱动信用卡推荐系统,集成OpenAI GPT、Telegram和Google Sheets
If
Set
Code
+7
31 节点Nishant
AI 聊天机器人
GPT-4驱动的冷邮件工作流,包含完全定制的3封邮件跟进
使用GPT-4、Mailgun和Supabase自动化个性化冷邮件序列
If
Set
Code
+22
100 节点Paul
客户培育
宠物美容发布与预约自动化
使用AI、Facebook和Telegram机器人自动化宠物美容发布与预约
If
Set
Switch
+17
36 节点Christian Moises
AI 聊天机器人
我的工作流
卡路里追踪与饮食记录(Telegram、Gemini AI和数据表)
If
Set
Code
+13
73 节点Gerald Denor
内容创作
完整的 B2B 销售流程:Apollo 潜在客户生成、Mailgun 外展和 AI 回复管理
完整的 B2B 销售流程:Apollo 潜在客户生成、Mailgun 外展和 AI 回复管理
If
Set
Code
+26
116 节点Paul
内容创作
我的工作流2
使用多个GPT-4o AI代理管理个人数据:Telegram上的Gmail、任务和财务
Set
Code
Gmail
+14
62 节点Mahmoud Shrouf
AI 聊天机器人
工作流信息
难度等级
高级
节点数量33
分类2
节点类型9
作者
Yehor EGMS
@egm-systemsBusiness Automation & E-commerce Expert | Founder & Entrepreneur | N8n.io & Make.com Specialist | Automate >80% of routine tasks — helping businesses reduce costs and accelerate processes
外部链接
在 n8n.io 查看 →
分享此工作流