通过Telegram机器人和OCR从图像中提取文本
中级
这是一个Personal Productivity, Multimodal AI领域的自动化工作流,包含 8 个节点。主要使用 Set, Telegram, HttpRequest, Agent, ExtractFromFile 等节点。 通过Telegram机器人和OCR从图像中提取文本
前置要求
- •Telegram Bot Token
- •可能需要目标 API 的认证凭证
- •Google Gemini API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "M4IIL41O16twgImq",
"meta": {
"instanceId": "51be389492931e958da1ec3c4cc03c8044ac06dd89d9465126f3cdb442363742",
"templateCredsSetupCompleted": true
},
"name": "图像读取器",
"tags": [],
"nodes": [
{
"id": "a5d05f82-eb64-4abb-82d8-c2365fea90e8",
"name": "Telegram 触发器",
"type": "n8n-nodes-base.telegramTrigger",
"position": [
-400,
-140
],
"webhookId": "b957dd8b-8f10-40e9-a041-56b3f7a176b9",
"parameters": {
"updates": [
"message"
],
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "coZ5n0FecDwDueBA",
"name": "Ruri Image Reader"
}
},
"typeVersion": 1.2
},
{
"id": "9c8d3318-b6f8-4fe5-8d19-10388087beb7",
"name": "清理输入数据",
"type": "n8n-nodes-base.set",
"position": [
-180,
-140
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "c8cd1608-2326-401d-9c47-79a6a72f5fc7",
"name": "chatID",
"type": "number",
"value": "={{ $json.message.chat.id }}"
},
{
"id": "0f1a41cb-8630-4e10-b445-f6bbbcf91d33",
"name": "Image",
"type": "string",
"value": "={{ $json[\"message\"][\"photo\"][$json[\"message\"][\"photo\"].length - 1][\"file_id\"] }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "e2b58308-238e-4439-9f1a-4d08b6c6fed0",
"name": "OCR",
"type": "n8n-nodes-base.httpRequest",
"position": [
480,
-140
],
"parameters": {
"url": "#",
"method": "POST",
"options": {},
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "image",
"value": "={{ $json.data }}"
}
]
}
},
"notesInFlow": true,
"typeVersion": 4.2
},
{
"id": "ffb53d49-3a5f-4a65-95bd-0788f5005fc7",
"name": "获取文件",
"type": "n8n-nodes-base.telegram",
"position": [
40,
-140
],
"webhookId": "089cb9a3-a383-4e1d-b732-b877833ef538",
"parameters": {
"fileId": "={{ $json.Image.replace(/\\n/g, '') }}",
"resource": "file"
},
"credentials": {
"telegramApi": {
"id": "coZ5n0FecDwDueBA",
"name": "Ruri Image Reader"
}
},
"typeVersion": 1.2
},
{
"id": "80dc7a76-dc50-4f9f-8396-9f068fdec7a1",
"name": "转换为 base64",
"type": "n8n-nodes-base.extractFromFile",
"position": [
260,
-140
],
"parameters": {
"options": {},
"operation": "binaryToPropery"
},
"typeVersion": 1
},
{
"id": "e77fb512-c83c-4d18-9ded-13c02abfef45",
"name": "Telegram",
"type": "n8n-nodes-base.telegram",
"position": [
1076,
-140
],
"webhookId": "1c599e35-fb24-4cae-9177-61fa09e0b5ca",
"parameters": {
"text": "={{ $json.output }}",
"chatId": "={{ $('Clean Input Data').item.json.chatID }}",
"additionalFields": {
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"id": "coZ5n0FecDwDueBA",
"name": "Ruri Image Reader"
}
},
"typeVersion": 1.2
},
{
"id": "5badb159-c0e8-4129-8387-409541cdcc20",
"name": "AI 代理",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
700,
-140
],
"parameters": {
"text": "={{ $json.text }}",
"options": {
"systemMessage": "You are an AI assistant designed to enhance the clarity of text extracted from images using OCR.\n\nYour primary objective is to make the OCR output easy to read and understand for end users by cleaning up formatting, fixing any recognition errors, and restructuring the content logically.\n\n🧠 Behavior Guidelines:\nIf the extracted text resembles a table or structured data, do not recreate the table. Instead, summarize the content into bullet points for better readability.\n\nFocus on clarity, accuracy, and user-friendly formatting.\n\nFix common OCR issues such as:\n\nBroken words or lines\n\nIncorrect character recognition (e.g., \"0\" vs \"O\", \"1\" vs \"I\")\n\nMisplaced symbols or formatting errors"
},
"promptType": "define"
},
"typeVersion": 2
},
{
"id": "76959791-ff08-4f0f-94c1-55b6f6807a00",
"name": "Google Gemini 聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
788,
80
],
"parameters": {
"options": {},
"modelName": "models/gemini-2.0-flash"
},
"credentials": {
"googlePalmApi": {
"id": "fyhkQ6QL2SEoobiQ",
"name": "Google Gemini(PaLM) Api account"
}
},
"typeVersion": 1
}
],
"active": true,
"pinData": {
"Telegram Trigger": [
{
"json": {
"message": {
"chat": {
"id": 1335515855,
"type": "private",
"username": "VextCode",
"first_name": "Vext"
},
"date": 1751041672,
"from": {
"id": 1335515855,
"is_bot": false,
"username": "VextCode",
"first_name": "Vext",
"language_code": "en"
},
"photo": [
{
"width": 90,
"height": 39,
"file_id": "AgACAgUAAxkBAAMOaF7GiHkZdpULOrfUb-SAge6yRHcAAq_LMRubo_BWUWlWZpaHvCIBAAMCAANzAAM2BA",
"file_size": 1131,
"file_unique_id": "AQADr8sxG5uj8FZ4"
},
{
"width": 320,
"height": 137,
"file_id": "AgACAgUAAxkBAAMOaF7GiHkZdpULOrfUb-SAge6yRHcAAq_LMRubo_BWUWlWZpaHvCIBAAMCAANtAAM2BA",
"file_size": 14625,
"file_unique_id": "AQADr8sxG5uj8FZy"
},
{
"width": 800,
"height": 342,
"file_id": "AgACAgUAAxkBAAMOaF7GiHkZdpULOrfUb-SAge6yRHcAAq_LMRubo_BWUWlWZpaHvCIBAAMCAAN4AAM2BA",
"file_size": 60871,
"file_unique_id": "AQADr8sxG5uj8FZ9"
},
{
"width": 1095,
"height": 468,
"file_id": "AgACAgUAAxkBAAMOaF7GiHkZdpULOrfUb-SAge6yRHcAAq_LMRubo_BWUWlWZpaHvCIBAAMCAAN5AAM2BA",
"file_size": 90710,
"file_unique_id": "AQADr8sxG5uj8FZ-"
}
],
"message_id": 14
},
"update_id": 413913333
}
}
]
},
"settings": {
"executionOrder": "v1"
},
"versionId": "a78997d0-05cb-4278-8be3-7348cfa1eefa",
"connections": {
"e2b58308-238e-4439-9f1a-4d08b6c6fed0": {
"main": [
[
{
"node": "5badb159-c0e8-4129-8387-409541cdcc20",
"type": "main",
"index": 0
}
]
]
},
"5badb159-c0e8-4129-8387-409541cdcc20": {
"main": [
[
{
"node": "e77fb512-c83c-4d18-9ded-13c02abfef45",
"type": "main",
"index": 0
}
]
]
},
"ffb53d49-3a5f-4a65-95bd-0788f5005fc7": {
"main": [
[
{
"node": "80dc7a76-dc50-4f9f-8396-9f068fdec7a1",
"type": "main",
"index": 0
}
]
]
},
"9c8d3318-b6f8-4fe5-8d19-10388087beb7": {
"main": [
[
{
"node": "ffb53d49-3a5f-4a65-95bd-0788f5005fc7",
"type": "main",
"index": 0
}
]
]
},
"a5d05f82-eb64-4abb-82d8-c2365fea90e8": {
"main": [
[
{
"node": "9c8d3318-b6f8-4fe5-8d19-10388087beb7",
"type": "main",
"index": 0
}
]
]
},
"80dc7a76-dc50-4f9f-8396-9f068fdec7a1": {
"main": [
[
{
"node": "e2b58308-238e-4439-9f1a-4d08b6c6fed0",
"type": "main",
"index": 0
}
]
]
},
"76959791-ff08-4f0f-94c1-55b6f6807a00": {
"ai_languageModel": [
[
{
"node": "5badb159-c0e8-4129-8387-409541cdcc20",
"type": "ai_languageModel",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级 - 个人效率, 多模态 AI
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
图像阅读器 Gemini OCR
通过Telegram机器人和Gemini 2.0 Flash OCR从图像中提取文本
Set
Telegram
Http Request
+
Set
Telegram
Http Request
8 节点Rudi Afandi
文档提取
LinkedIn和X病毒内容自动引擎
使用AI生成和发布自动创建LinkedIn和X的病毒内容
If
Set
Wait
+
If
Set
Wait
156 节点Diptamoy Barman
内容创作
使用Gemini、语音和图像生成构建多模态Telegram AI助手
使用Gemini、语音和图像生成构建多模态Telegram AI助手
If
Set
Code
+
If
Set
Code
95 节点Iniyavan JC
个人效率
1. 播放列表详情设置机器人副本
使用 Suno、GPT-4、Runway 和 Creatomate 创建 AI 生成的 YouTube 音乐播放列表
If
Set
Code
+
If
Set
Code
203 节点Joseph
内容创作
使用 GPT-4o、ElevenLabs 和 WaveSpeed 口型同步创建真实
使用 GPT-4o、ElevenLabs 和 WaveSpeed 口型同步创建真实 UGC 视频广告
If
Set
Wait
+
If
Set
Wait
38 节点Muhammad Farooq Iqbal
内容创作
Telegram论坛脉搏:使用Gemini和Groq AI模型的社区监控
Telegram论坛脉搏:使用Gemini和Groq AI模型的社区监控
If
Set
Code
+
If
Set
Code
59 节点Nguyen Thieu Toan
杂项