图像阅读器 Gemini OCR
中级
这是一个Document Extraction, Multimodal AI领域的自动化工作流,包含 8 个节点。主要使用 Set, Telegram, HttpRequest, ExtractFromFile, TelegramTrigger 等节点。 通过Telegram机器人和Gemini 2.0 Flash OCR从图像中提取文本
前置要求
- •Telegram Bot Token
- •可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "XqNsiUSOpgO7PRPD",
"meta": {
"instanceId": "51be389492931e958da1ec3c4cc03c8044ac06dd89d9465126f3cdb442363742",
"templateCredsSetupCompleted": true
},
"name": "图像阅读器 Gemini OCR",
"tags": [],
"nodes": [
{
"id": "fa672106-597a-43d6-b3c8-d7d73e9ad499",
"name": "Telegram 触发器",
"type": "n8n-nodes-base.telegramTrigger",
"position": [
-360,
-140
],
"webhookId": "9b8e55dc-1389-435a-95b3-030d7e30ebce",
"parameters": {
"updates": [
"message"
],
"additionalFields": {
"download": true
}
},
"credentials": {
"telegramApi": {
"id": "coZ5n0FecDwDueBA",
"name": "@RuriImageReader_bot"
}
},
"typeVersion": 1.2
},
{
"id": "552d5953-2b1e-48ff-a39b-112cae330f32",
"name": "清理输入数据",
"type": "n8n-nodes-base.set",
"position": [
-140,
-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": "4127fe82-7700-4292-b4fc-6fc27aa9e27c",
"name": "获取文件",
"type": "n8n-nodes-base.telegram",
"position": [
80,
-140
],
"webhookId": "b812a0c8-e5f5-4969-9fad-a7b5b6e72dd9",
"parameters": {
"fileId": "={{ $json.Image.replace(/\\n/g, '') }}",
"resource": "file"
},
"credentials": {
"telegramApi": {
"id": "coZ5n0FecDwDueBA",
"name": "@RuriImageReader_bot"
}
},
"typeVersion": 1.2
},
{
"id": "cdee68db-f387-48d6-8b1c-2f1de0fbefea",
"name": "Telegram",
"type": "n8n-nodes-base.telegram",
"position": [
80,
120
],
"webhookId": "8219e2f1-2393-40ee-9c84-88666b10d946",
"parameters": {
"text": "={{ $json.output }}",
"chatId": "={{ $('Clean Input Data').item.json.chatID }}",
"additionalFields": {
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"id": "coZ5n0FecDwDueBA",
"name": "@RuriImageReader_bot"
}
},
"typeVersion": 1.2
},
{
"id": "d9ef5251-9fb1-4810-aa78-4a393f4355e7",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-440,
-200
],
"parameters": {
"color": 4,
"width": 920,
"height": 620,
"content": "## 图像阅读器"
},
"typeVersion": 1
},
{
"id": "ecb87468-671d-484c-9baf-01d40e6f5de6",
"name": "Gemini OCR",
"type": "n8n-nodes-base.httpRequest",
"position": [
-360,
120
],
"parameters": {
"url": "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent",
"method": "POST",
"options": {},
"jsonBody": "={\n \"contents\": [\n {\n \"role\": \"user\",\n \"parts\": [\n {\n \"inlineData\": {\n \"mimeType\": \"image/jpeg\",\n \"data\": \"{{ $json.data }}\"\n }\n },\n {\n \"text\": \"Extract text\"\n }\n ]\n }\n ]\n}",
"sendBody": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "httpQueryAuth"
},
"credentials": {
"httpQueryAuth": {
"id": "wcX4Li4YomZJHh1s",
"name": "Gemini API"
}
},
"typeVersion": 4.2
},
{
"id": "2990b76a-536e-48b4-8202-21b82ead2ef1",
"name": "从文件提取",
"type": "n8n-nodes-base.extractFromFile",
"position": [
320,
-140
],
"parameters": {
"options": {},
"operation": "binaryToPropery"
},
"typeVersion": 1
},
{
"id": "71b92a9e-8393-4f00-a99d-123ea4f3ed19",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-700,
-200
],
"parameters": {
"height": 1060,
"content": "## HTTP Gemini OCR 设置"
},
"typeVersion": 1
}
],
"active": true,
"pinData": {
"Telegram Trigger": [
{
"json": {
"message": {
"chat": {
"id": 1335515855,
"type": "private",
"username": "VextCode",
"first_name": "Vext"
},
"date": 1752202117,
"from": {
"id": 1335515855,
"is_bot": false,
"username": "VextCode",
"first_name": "Vext",
"language_code": "en"
},
"photo": [
{
"width": 90,
"height": 47,
"file_id": "AgACAgUAAxkBAAN9aHB7hU8nKT7coClCdMyelOTFy-sAAsPKMRvnqolXYKE3ScdP6HABAAMCAANzAAM2BA",
"file_size": 1128,
"file_unique_id": "AQADw8oxG-eqiVd4"
},
{
"width": 320,
"height": 168,
"file_id": "AgACAgUAAxkBAAN9aHB7hU8nKT7coClCdMyelOTFy-sAAsPKMRvnqolXYKE3ScdP6HABAAMCAANtAAM2BA",
"file_size": 18516,
"file_unique_id": "AQADw8oxG-eqiVdy"
},
{
"width": 800,
"height": 420,
"file_id": "AgACAgUAAxkBAAN9aHB7hU8nKT7coClCdMyelOTFy-sAAsPKMRvnqolXYKE3ScdP6HABAAMCAAN4AAM2BA",
"file_size": 73842,
"file_unique_id": "AQADw8oxG-eqiVd9"
},
{
"width": 1200,
"height": 630,
"file_id": "AgACAgUAAxkBAAN9aHB7hU8nKT7coClCdMyelOTFy-sAAsPKMRvnqolXYKE3ScdP6HABAAMCAAN5AAM2BA",
"file_size": 86132,
"file_unique_id": "AQADw8oxG-eqiVd-"
}
],
"message_id": 125
},
"update_id": 413913388
}
}
]
},
"settings": {
"executionOrder": "v1"
},
"versionId": "c571dd01-5b7e-4ee1-88d1-d33abb86e78b",
"connections": {
"get file": {
"main": [
[
{
"node": "Extract from File",
"type": "main",
"index": 0
}
]
]
},
"Gemini OCR": {
"main": [
[
{
"node": "Telegram",
"type": "main",
"index": 0
}
]
]
},
"Clean Input Data": {
"main": [
[
{
"node": "get file",
"type": "main",
"index": 0
}
]
]
},
"Telegram Trigger": {
"main": [
[
{
"node": "Clean Input Data",
"type": "main",
"index": 0
}
]
]
},
"Extract from File": {
"main": [
[
{
"node": "Gemini OCR",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级 - 文档提取, 多模态 AI
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
图像读取器
通过Telegram机器人和OCR从图像中提取文本
Set
Telegram
Http Request
+4
8 节点Rudi Afandi
个人效率
GPT-4o Vision与Telegram图像分析与文本提取
使用GPT-4o Vision和Telegram分析图像并提取文本
Code
Telegram
Http Request
+3
16 节点AI/ML API | D1m7asis
文档提取
音频转录 - n8n创作者(模板)
使用Telegram和Groq Whisper的音频转录
If
Set
Switch
+5
22 节点Abhiman
文档提取
Telegram智能文件管理器(Drive + OCR集成)
使用Telegram、Drive、OCR和Airtable构建可搜索文档档案库
If
Set
Merge
+6
33 节点Oneclick AI Squad
文档提取
家居装饰AI(Google Nano Banana)- Santhej Kallada
基于Google Gemini的AI图像生成与编辑及Telegram机器人
If
Set
Code
+9
28 节点Santhej Kallada
内容创作
LinkedIn和X病毒内容自动引擎
使用AI生成和发布自动创建LinkedIn和X的病毒内容
If
Set
Wait
+26
156 节点Diptamoy Barman
内容创作