Telegram AI代理基础模板
高级
这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 31 个节点。主要使用 Set, Merge, Switch, Telegram, DateTimeTool 等节点。 基于Claude和Gemini支持语音、图像和视频分析的多模态Telegram机器人
前置要求
- •Telegram Bot Token
- •OpenAI API Key
- •Anthropic API Key
使用的节点 (31)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "EqwHkiMliEvlONN6",
"meta": {
"instanceId": "e3f5b14dd829b60d7a052fff9dcdd349fd20ca18d74a872c51a793bc94cd4aaa",
"templateCredsSetupCompleted": true
},
"name": "Telegram AI Agent 基础模板",
"tags": [],
"nodes": [
{
"id": "fe57df5b-9bd6-4b89-9f2a-7e492f007ee6",
"name": "Telegram触发器",
"type": "n8n-nodes-base.telegramTrigger",
"position": [
-16,
224
],
"webhookId": "68e2da8a-4bb2-45a8-9e6d-9b4b1509bf9a",
"parameters": {
"updates": [
"message"
],
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "7TfAmUIywKxzqqhO",
"name": "DigiceptualBot"
}
},
"typeVersion": 1.2
},
{
"id": "8f54add4-f32f-41a5-be2f-9602c8c0235e",
"name": "Google Calendar MCP",
"type": "n8n-nodes-base.switch",
"position": [
224,
176
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "Do Nothing",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "611dbffc-c663-48c9-9e10-c045f26f4505",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.message.text }}",
"rightValue": "/start"
}
]
},
"renameOutput": true
},
{
"outputKey": "voice",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "2c19aba8-aba2-4cf2-aefc-1f1af9277f5d",
"operator": {
"type": "object",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.message.voice }}",
"rightValue": ""
}
]
},
"renameOutput": true
},
{
"outputKey": "picture",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "5e324898-f3d5-4a84-8ca4-94a33849cd6d",
"operator": {
"type": "array",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.message.photo }}",
"rightValue": ""
}
]
},
"renameOutput": true
},
{
"outputKey": "video",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "7b448a1b-5f96-42e3-bfce-dad6b5c45f01",
"operator": {
"type": "object",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.message.video }}",
"rightValue": ""
}
]
},
"renameOutput": true
},
{
"outputKey": "text",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "e4174e28-530a-42ab-92f8-3ab0b79c7684",
"operator": {
"type": "string",
"operation": "notEquals"
},
"leftValue": "={{ $json.message.text }}",
"rightValue": "/start"
}
]
},
"renameOutput": true
}
]
},
"options": {}
},
"typeVersion": 3.2
},
{
"id": "ab6b3c42-8f87-4d9c-b446-467420ba89dc",
"name": "无操作,不执行任何操作",
"type": "n8n-nodes-base.noOp",
"position": [
544,
-224
],
"parameters": {},
"typeVersion": 1
},
{
"id": "0fe10676-1310-427c-af4c-c0d1553ffd7f",
"name": "AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
1424,
144
],
"parameters": {
"text": "={{ $json[\"User Input\"] }}",
"options": {
"systemMessage": "You are a helpful, intelligent assistant.\n\nOutput ONLY a plain UTF-8 string for Telegram. \nNo JSON. No code fences. No prefaces. \nIf content is empty, output \"…\"."
},
"promptType": "define"
},
"typeVersion": 2.2
},
{
"id": "91108b1b-d794-41bf-becc-df8fa7c5bf72",
"name": "转录录音",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
784,
16
],
"parameters": {
"options": {},
"resource": "audio",
"operation": "transcribe"
},
"credentials": {
"openAiApi": {
"id": "nNUPQt28U7stZkxv",
"name": "OpenAi account"
}
},
"typeVersion": 1.8
},
{
"id": "e93e0d43-cb1d-48e1-8677-4a6a70512e7b",
"name": "简单记忆",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
1536,
448
],
"parameters": {
"sessionKey": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
"sessionIdType": "customKey",
"contextWindowLength": 50
},
"typeVersion": 1.3
},
{
"id": "a9810f69-059a-49e6-93f2-54e7cd71ea66",
"name": "日期与时间",
"type": "n8n-nodes-base.dateTimeTool",
"position": [
1792,
464
],
"parameters": {
"options": {}
},
"typeVersion": 2
},
{
"id": "fdd5cb5d-3a2d-41f6-88db-ae13d8bd6507",
"name": "Anthropic 聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
"position": [
1264,
448
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "claude-sonnet-4-20250514",
"cachedResultName": "Claude Sonnet 4"
},
"options": {
"maxTokensToSample": 10000
}
},
"credentials": {
"anthropicApi": {
"id": "y5udJNdCdTzH3Zy2",
"name": "Keith's Anthropic Connection"
}
},
"typeVersion": 1.3
},
{
"id": "d4d3204f-590e-4d7e-ba65-bfc8cab50c6b",
"name": "发送常规消息",
"type": "n8n-nodes-base.telegram",
"position": [
1776,
144
],
"webhookId": "c213a4f1-9cfd-49cb-b57e-f7074a62a29a",
"parameters": {
"text": "={{ $('AI Agent').item.json.output }}",
"chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
"additionalFields": {
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"id": "7TfAmUIywKxzqqhO",
"name": "DigiceptualBot"
}
},
"typeVersion": 1.2
},
{
"id": "b24c21d7-ba1a-460e-8575-3908e450d9ad",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-528,
-48
],
"parameters": {
"color": 7,
"width": 432,
"height": 560,
"content": "# 使用说明"
},
"typeVersion": 1
},
{
"id": "a7c7769a-498a-43ed-bc54-f8d5df6f4b63",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-64,
-48
],
"parameters": {
"color": 5,
"width": 208,
"height": 496,
"content": "### 等待 Telegram 消息以启动工作流"
},
"typeVersion": 1
},
{
"id": "5b0a6572-dcb8-4607-8f68-7b1f57074c1d",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
176,
-48
],
"parameters": {
"color": 5,
"width": 208,
"height": 496,
"content": "### 判断发送的消息类型"
},
"typeVersion": 1
},
{
"id": "c90fc3ab-dfee-41de-9da0-2cedc8ae1a8b",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
480,
-48
],
"parameters": {
"color": 5,
"width": 192,
"height": 208,
"content": "### 获取音频文件"
},
"typeVersion": 1
},
{
"id": "2d3fef65-2c63-4672-ba2e-dc8c4dce3050",
"name": "便签4",
"type": "n8n-nodes-base.stickyNote",
"position": [
736,
-48
],
"parameters": {
"color": 5,
"width": 208,
"height": 208,
"content": "### 使用 OpenAI 转录录音"
},
"typeVersion": 1
},
{
"id": "98231e32-f8c9-4489-a190-c531beee462f",
"name": "便签5",
"type": "n8n-nodes-base.stickyNote",
"position": [
1200,
352
],
"parameters": {
"width": 224,
"height": 224,
"content": "### 在此处选择任意 LLM"
},
"typeVersion": 1
},
{
"id": "27be2872-1ff2-44f3-95df-aa9e2dcc2f37",
"name": "便签6",
"type": "n8n-nodes-base.stickyNote",
"position": [
1392,
-48
],
"parameters": {
"color": 5,
"width": 288,
"height": 368,
"content": "### 基础 AI Agent。调整\"系统提示\"以根据需求个性化此代理"
},
"typeVersion": 1
},
{
"id": "1c156152-bd4d-4294-b462-2739ae45ca07",
"name": "便签7",
"type": "n8n-nodes-base.stickyNote",
"position": [
1712,
-48
],
"parameters": {
"color": 5,
"width": 224,
"height": 368,
"content": "### 通过 Telegram 将 AI Agent 输出发送给您"
},
"typeVersion": 1
},
{
"id": "dd9c35a4-89dc-4c3d-9f22-ef3ca0d198dd",
"name": "## 为什么选择 4o 模型?👆",
"type": "n8n-nodes-base.stickyNote",
"position": [
1472,
352
],
"parameters": {
"width": 208,
"height": 224,
"content": "### 选择 LLM 可读取的消息数量"
},
"typeVersion": 1
},
{
"id": "8310f4e1-07f2-458a-8d41-a347aca32136",
"name": "便签9",
"type": "n8n-nodes-base.stickyNote",
"position": [
1712,
352
],
"parameters": {
"width": 224,
"height": 224,
"content": "### 在此处添加 LLM 可访问的工具"
},
"typeVersion": 1
},
{
"id": "8779f8c2-1ab3-45a9-8787-0177b2b09534",
"name": "便签10",
"type": "n8n-nodes-base.stickyNote",
"position": [
480,
224
],
"parameters": {
"color": 5,
"width": 192,
"height": 224,
"content": "### 获取图片文件"
},
"typeVersion": 1
},
{
"id": "5fd1f209-90cf-4956-a029-b7fa86d4f4e0",
"name": "便签11",
"type": "n8n-nodes-base.stickyNote",
"position": [
736,
224
],
"parameters": {
"color": 5,
"width": 208,
"height": 224,
"content": "### 使用 Gemini 分析图片"
},
"typeVersion": 1
},
{
"id": "6a3a4517-dbef-4a21-83d1-55bd8f6f6970",
"name": "合并",
"type": "n8n-nodes-base.merge",
"position": [
1040,
112
],
"parameters": {
"numberInputs": 4
},
"typeVersion": 3.2
},
{
"id": "6ec2e6c7-ebbd-4ad2-a74d-9078bd115b4d",
"name": "编辑字段",
"type": "n8n-nodes-base.set",
"position": [
1232,
144
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "4f68c522-dd1e-45dc-ab39-f5b640bfe274",
"name": "User Input",
"type": "string",
"value": "={{$json.text || $json.message?.text || $json.content || $json[\"data\"] || $json.result || $json.transcription || \"\"}}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "f63eda5b-4609-4e7c-9970-9b9e27a301c8",
"name": "便签12",
"type": "n8n-nodes-base.stickyNote",
"position": [
1200,
-48
],
"parameters": {
"color": 5,
"width": 160,
"height": 368,
"content": "### 创建统一输入传递给 AI Agent"
},
"typeVersion": 1
},
{
"id": "ec2895ca-8912-4b4d-88e3-f6edd46e6a3c",
"name": "获取音频文件",
"type": "n8n-nodes-base.telegram",
"position": [
528,
16
],
"webhookId": "0a8d24f6-162c-4ed5-8cc7-ff35141993f0",
"parameters": {
"fileId": "={{ $json.message.voice.file_id }}",
"resource": "file",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "7TfAmUIywKxzqqhO",
"name": "DigiceptualBot"
}
},
"typeVersion": 1.2
},
{
"id": "f8290197-046a-448f-86d0-154fed593d21",
"name": "获取图片",
"type": "n8n-nodes-base.telegram",
"position": [
528,
304
],
"webhookId": "0a8d24f6-162c-4ed5-8cc7-ff35141993f0",
"parameters": {
"fileId": "={{ $json.message.photo[0].file_id }}",
"resource": "file",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "7TfAmUIywKxzqqhO",
"name": "DigiceptualBot"
}
},
"typeVersion": 1.2
},
{
"id": "a9af3fbf-5945-4f79-b994-95de3a9c924c",
"name": "获取视频文件",
"type": "n8n-nodes-base.telegram",
"position": [
528,
592
],
"webhookId": "0a8d24f6-162c-4ed5-8cc7-ff35141993f0",
"parameters": {
"fileId": "={{ $json.message.video.file_id }}",
"resource": "file",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "7TfAmUIywKxzqqhO",
"name": "DigiceptualBot"
}
},
"typeVersion": 1.2
},
{
"id": "262a8562-66ac-4834-b424-cbe36fad8a48",
"name": "便签13",
"type": "n8n-nodes-base.stickyNote",
"position": [
480,
512
],
"parameters": {
"color": 5,
"width": 192,
"height": 240,
"content": "### 获取视频文件"
},
"typeVersion": 1
},
{
"id": "6a25a9e7-8839-4de4-b5f4-2d8d7ed63a44",
"name": "便签14",
"type": "n8n-nodes-base.stickyNote",
"position": [
736,
512
],
"parameters": {
"color": 5,
"width": 208,
"height": 240,
"content": "### 使用 Gemini 分析视频"
},
"typeVersion": 1
},
{
"id": "5ba18177-7feb-4455-976b-14f819f9c449",
"name": "分析视频",
"type": "@n8n/n8n-nodes-langchain.googleGemini",
"position": [
784,
592
],
"parameters": {
"text": "={{ $('Telegram Trigger').item.json.message.caption || $('Telegram Trigger').item.json.message.text }}",
"modelId": {
"__rl": true,
"mode": "list",
"value": "models/gemini-2.5-flash",
"cachedResultName": "models/gemini-2.5-flash"
},
"options": {},
"resource": "video",
"inputType": "binary",
"operation": "analyze"
},
"credentials": {
"googlePalmApi": {
"id": "82HZGtRNVMLV9eBr",
"name": "Keith's Gemini API Key"
}
},
"typeVersion": 1
},
{
"id": "a418361f-6f9e-4c4b-ad56-4454b94e7660",
"name": "分析图片",
"type": "@n8n/n8n-nodes-langchain.googleGemini",
"position": [
784,
304
],
"parameters": {
"text": "={{ $('Telegram Trigger').item.json.message.caption || $('Telegram Trigger').item.json.message.text }}",
"modelId": {
"__rl": true,
"mode": "list",
"value": "models/gemini-2.5-flash",
"cachedResultName": "models/gemini-2.5-flash"
},
"options": {},
"resource": "image",
"inputType": "binary",
"operation": "analyze"
},
"credentials": {
"googlePalmApi": {
"id": "82HZGtRNVMLV9eBr",
"name": "Keith's Gemini API Key"
}
},
"typeVersion": 1
}
],
"active": true,
"pinData": {
"Telegram Trigger": [
{
"json": {
"message": {
"chat": {
"id": 5700871700,
"type": "private",
"username": "Keith_S_Uy",
"last_name": "Uy",
"first_name": "Keith"
},
"date": 1758972932,
"from": {
"id": 5700871700,
"is_bot": false,
"username": "Keith_S_Uy",
"last_name": "Uy",
"first_name": "Keith",
"language_code": "en"
},
"video": {
"thumb": {
"width": 175,
"height": 320,
"file_id": "AAMCBQADGQEAA1ho18wEtmAvBZFFoNzPJoZExzt_KgACCxkAAoukwVY2DnM68J5GWAEAB20AAzYE",
"file_size": 11492,
"file_unique_id": "AQADCxkAAoukwVZy"
},
"width": 464,
"height": 848,
"file_id": "BAACAgUAAxkBAANYaNfMBLZgLwWRRaDczyaGRMc7fyoAAgsZAAKLpMFWNg5zOvCeRlg2BA",
"duration": 14,
"file_name": "IMG_5645.MOV",
"file_size": 2865541,
"mime_type": "video/mp4",
"thumbnail": {
"width": 175,
"height": 320,
"file_id": "AAMCBQADGQEAA1ho18wEtmAvBZFFoNzPJoZExzt_KgACCxkAAoukwVY2DnM68J5GWAEAB20AAzYE",
"file_size": 11492,
"file_unique_id": "AQADCxkAAoukwVZy"
},
"file_unique_id": "AgADCxkAAoukwVY"
},
"caption": "how about this video?",
"message_id": 88
},
"update_id": 761662429
}
}
]
},
"settings": {
"executionOrder": "v1"
},
"versionId": "437597a2-50e4-409b-b678-d3944d857352",
"connections": {
"Merge": {
"main": [
[
{
"node": "Edit Fields",
"type": "main",
"index": 0
}
]
]
},
"Switch": {
"main": [
[
{
"node": "No Operation, do nothing",
"type": "main",
"index": 0
}
],
[
{
"node": "Get a Audio File",
"type": "main",
"index": 0
}
],
[
{
"node": "Get a Photo",
"type": "main",
"index": 0
}
],
[
{
"node": "Get a Video File",
"type": "main",
"index": 0
}
],
[
{
"node": "Merge",
"type": "main",
"index": 1
}
]
]
},
"AI Agent": {
"main": [
[
{
"node": "Send Regular Message",
"type": "main",
"index": 0
}
]
]
},
"Date & Time": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Edit Fields": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"Get a Photo": {
"main": [
[
{
"node": "Analyze an image",
"type": "main",
"index": 0
}
]
]
},
"Analyze video": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 3
}
]
]
},
"Simple Memory": {
"ai_memory": [
[
{
"node": "AI Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"Analyze an image": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 2
}
]
]
},
"Get a Audio File": {
"main": [
[
{
"node": "Transcribe a recording",
"type": "main",
"index": 0
}
]
]
},
"Get a Video File": {
"main": [
[
{
"node": "Analyze video",
"type": "main",
"index": 0
}
]
]
},
"Telegram Trigger": {
"main": [
[
{
"node": "Switch",
"type": "main",
"index": 0
}
]
]
},
"Anthropic Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Transcribe a recording": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 内容创作, 多模态 AI
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
Slack AI代理基础
支持语音、图像和视频处理的多模态Slack AI助手
Set
Merge
Slack
+10
34 节点Keith Uy
内容创作
完整的 B2B 销售流程:Apollo 潜在客户生成、Mailgun 外展和 AI 回复管理
完整的 B2B 销售流程:Apollo 潜在客户生成、Mailgun 外展和 AI 回复管理
If
Set
Code
+26
116 节点Paul
内容创作
我的工作流
卡路里追踪与饮食记录(Telegram、Gemini AI和数据表)
If
Set
Code
+13
73 节点Gerald Denor
内容创作
使用 Telegram 和 Google Gemini 的个人助理机器人
基于 Telegram 和 Google Gemini 的多模态个人AI助手,集成生产力工具
Set
Code
Merge
+16
83 节点Anshul Chauhan
内容创作
使用OpenAI Whisper和Gemini将Telegram内容转换为多平台帖子
使用OpenAI Whisper和Gemini将Telegram内容转换为多平台帖子
If
Set
Switch
+10
63 节点Juan Carlos Cavero Gracia
内容创作
GPT-4驱动的冷邮件工作流,包含完全定制的3封邮件跟进
使用GPT-4、Mailgun和Supabase自动化个性化冷邮件序列
If
Set
Code
+22
100 节点Paul
客户培育