This workflow corresponds to n8n.io template #5413 — we link there as the canonical source.
This workflow follows the Agent → Google Gemini Chat recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"id": "M4IIL41O16twgImq",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "Image Reader",
"tags": [],
"nodes": [
{
"id": "a5d05f82-eb64-4abb-82d8-c2365fea90e8",
"name": "Telegram Trigger",
"type": "n8n-nodes-base.telegramTrigger",
"position": [
-400,
-220
],
"parameters": {
"updates": [
"message"
],
"additionalFields": {
"download": true
}
},
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "9c8d3318-b6f8-4fe5-8d19-10388087beb7",
"name": "Clean Input Data",
"type": "n8n-nodes-base.set",
"position": [
-180,
-220
],
"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": "ffb53d49-3a5f-4a65-95bd-0788f5005fc7",
"name": "get file",
"type": "n8n-nodes-base.telegram",
"position": [
40,
-220
],
"parameters": {
"fileId": "={{ $json.Image.replace(/\\n/g, '') }}",
"resource": "file"
},
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "e77fb512-c83c-4d18-9ded-13c02abfef45",
"name": "Telegram",
"type": "n8n-nodes-base.telegram",
"position": [
1076,
-220
],
"parameters": {
"text": "={{ $json.output }}",
"chatId": "={{ $('Clean Input Data').item.json.chatID }}",
"additionalFields": {
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "5badb159-c0e8-4129-8387-409541cdcc20",
"name": "AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
480,
-220
],
"parameters": {
"text": "={{ $json.text }}",
"options": {
"systemMessage": "Kamu adalah asisten AI yang dirancang untuk memperjelas teks hasil ekstraksi gambar melalui OCR.\n\nTujuan utamamu adalah membuat hasil OCR menjadi mudah dibaca dan dipahami oleh pengguna dengan cara merapikan format, memperbaiki kesalahan pengenalan karakter, dan menyusun ulang konten agar lebih logis.\n\n\ud83e\udde0 Panduan Perilaku:\nJika teks hasil OCR menyerupai tabel atau data terstruktur, jangan buat ulang dalam bentuk tabel. Sebagai gantinya, ubah menjadi poin-poin ringkas agar lebih mudah dibaca.\n\nFokus pada kejelasan, akurasi, dan format yang ramah pengguna.\n\nPerbaiki masalah umum pada hasil OCR seperti:\n\n- Kata atau kalimat yang terpotong\n- Karakter yang salah dikenali \n\ud835\udc50\n\ud835\udc5c\n\ud835\udc5b\n\ud835\udc61\n\ud835\udc5c\n\u210e\n:\n\"\n0\n\"\n\ud835\udc51\n\ud835\udc4e\n\ud835\udc5b\n\"\n\ud835\udc42\n\"\n,\n\"\n1\n\"\n\ud835\udc51\n\ud835\udc4e\n\ud835\udc5b\n\"\n\ud835\udc3c\n\"\ncontoh:\"0\"dan\"O\",\"1\"dan\"I\"\n- Simbol yang salah tempat atau format yang berantakan\n\nWAJIB Perhatikan, karena pesan ini akan dikirim ke Telegram maka hindari penggunaan karakter markdown seperti _, *, \n,\n,, \n,\n,, ~, >, #, +, -, =, |, {, }, ., !"
},
"promptType": "define"
},
"typeVersion": 2
},
{
"id": "76959791-ff08-4f0f-94c1-55b6f6807a00",
"name": "Google Gemini Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
568,
0
],
"parameters": {
"options": {},
"modelName": "models/gemini-2.0-flash"
},
"credentials": {
"googlePalmApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "c807e0eb-566b-46fb-8772-33cb6ab883df",
"name": "Replace",
"type": "n8n-nodes-base.code",
"position": [
856,
-220
],
"parameters": {
"jsCode": "let text = $json.output;\n\ntext = text\n .replace(/[_*[\\]()~`>#+\\-=|{}.!]/g, '\\\\$&'); // Escape karakter markdown V2\n\nreturn { json: { output: text } };\n"
},
"typeVersion": 2
},
{
"id": "f2faea2c-3a9c-4275-b92b-5fae4e04f2d1",
"name": "Tesseract OCR",
"type": "n8n-nodes-tesseractjs.tesseractNode",
"position": [
260,
-220
],
"parameters": {
"options": {}
},
"typeVersion": 1
}
],
"active": true,
"settings": {
"executionOrder": "v1"
},
"versionId": "93aeb6de-96dc-47f7-8bc7-218b283234f7",
"connections": {
"Replace": {
"main": [
[
{
"node": "Telegram",
"type": "main",
"index": 0
}
]
]
},
"AI Agent": {
"main": [
[
{
"node": "Replace",
"type": "main",
"index": 0
}
]
]
},
"get file": {
"main": [
[
{
"node": "Tesseract OCR",
"type": "main",
"index": 0
}
]
]
},
"Tesseract OCR": {
"main": [
[
{
"node": "AI Agent",
"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
}
]
]
},
"Google Gemini Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
}
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
googlePalmApitelegramApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Description This n8n workflow enables users to send an image to a Telegram bot and receive the extracted text using Tesseract OCR (via the n8n-nodes-tesseractjs Community Node). It's a quick and straightforward way to convert images into readable text directly through chat.
Source: https://n8n.io/workflows/5413/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
This workflow contains community nodes that are only compatible with the self-hosted version of n8n.
This workflow creates a multi-talented AI assistant named Simran that interacts with users via Telegram. It can handle text and voice messages, understand the user's intent, and perform various tasks.
This project is a template for building a complete academic virtual assistant using n8n. It connects to Telegram, answers frequently asked questions by querying MongoDB, keeps the community informed a
Telegram Trigger receives incoming messages (text, voice, photo, document). Switch routes by message type to appropriate processors: Text → forwarded as-is. Voice → downloaded and sent to Transcribe a
Transform your Telegram messenger into a powerful, multi-modal personal or team assistant. This n8n workflow creates an intelligent agent that can understand text, voice, images, and documents, and ta