Automate Optical Character Recognition (OCR) and text cleanup using an n8n workflow triggered by Telegram images. This n8n template uses AI agents for polished, readable output.
Download this n8n workflow template and start using it instantly.
• Users who frequently need to digitize text from photos (OCR) and require high accuracy.
• Businesses needing automated, reliable data extraction from image receipts, documents, or labels.
• Developers looking for advanced n8n templates integrating Telegram, external APIs, and AI Agents.
• Anyone seeking a powerful, chat-based OCR solution built using an efficient n8n workflow.
This comprehensive n8n workflow provides a robust solution for digitizing text from images received via Telegram. Standard Optical Character Recognition (OCR) often produces messy, poorly formatted results. This n8n workflow goes beyond simple extraction. It starts with the Telegram n8n trigger, seamlessly handles image retrieval and encoding, uses a dedicated n8n node for OCR via an external API, and then leverages the power of an AI Agent (powered by Google Gemini) to perform extensive text cleanup and enhancement. This means the final output is not just raw text, but a human-readable, corrected, and logically structured document, demonstrating the full capability of what a complex n8n automation can achieve.
The entire process is managed by a single automated n8n workflow, starting from a user action.
Telegram Trigger n8n node, activates when a user sends an image message to the linked bot.Clean Input Data n8n node uses a Set operation to extract essential information: the user's chatID (for the reply) and the fileid of the highest resolution image.get file Telegram n8n node downloads the actual image content using the extracted fileid.Convert to base64 n8n node prepares the binary file data for API transmission by transforming it into a base64 encoded string property.HTTP Request n8n node (labeled OCR) sends the base64 image payload to an external OCR service (requires custom configuration of the URL) to receive the initial raw text extraction.AI Agent n8n node. This agent is connected to the Google Gemini Chat Model and uses specific system instructions to fix recognition errors, improve formatting, and summarize complex text layouts into digestible bullet points.output) is finally sent back to the user's chatID via the last Telegram n8n node, completing this powerful n8n workflow.To set up this powerful n8n workflow, follow these steps:
Telegram Trigger and the final Telegram node). Ensure the Telegram Bot API key is configured and linked to the credentials named 'Ruri Image Reader' or update the credentials links within the imported n8n template.OCR (HTTP Request) n8n node is currently configured with a placeholder URL ('#'). You must update the URL and payload structure to match your chosen external OCR API service (e.g., Azure Cognitive Services, Tesseract wrapper, or a custom microservice).Telegram Trigger n8n node and the overall n8n workflow to start listening for incoming image messages.This n8n workflow relies on several specialized n8n node types to manage file handling, external API interaction, and AI processing:
Telegram Trigger (n8n trigger): The starting point of the n8n workflow. It is configured to listen for new 'message' updates, specifically filtering for messages containing images.
Clean Input Data (Set n8n node): Essential for flow control. It uses expressions (={{ $json.message.chat.id }} and array indexing for photo) to extract the user ID and the largest image file ID, cleaning the data for subsequent n8n nodes.
get file (Telegram n8n node): Downloads the image content from Telegram's servers using the file ID extracted in the previous step.
Convert to base64 (Extract From File n8n node): Changes the binary image file into a base64 string, which is the standard input format for most external OCR APIs.
OCR (HTTP Request n8n node): Sends the base64 encoded image data to the third-party OCR service to perform the core text extraction. This specific n8n node requires careful setup based on the chosen OCR provider's API documentation.
Google Gemini Chat Model (Language Model n8n node): Defines the large language model used for text refinement. It provides the computational engine for the AI Agent n8n node.
AI Agent (Langchain Agent n8n node): Receives the raw OCR text. It executes a complex prompt designed to clean up formatting errors, fix recognition mistakes, and restructure the output (e.g., summarizing tabular data) before the final step of the n8n workflow.
Telegram (Message n8n node): The final action. It uses the stored chatID to send the highly refined, easy-to-read output text back to the original user.
Use this powerful n8n workflow to create a Telegram bot that performs Optical Character Recognition (OCR) on uploaded images using the Gemini 2.0 Flash API. A perfect n8n templates for AI integration.

Use this comprehensive n8n workflow to create a Telegram bot that extracts text from uploaded images (PNG/JPG) and PDFs using Mistral OCR, returning the result as a Markdown file. Includes secure whitelisting.

Use this comprehensive n8n workflow to automate Optical Character Recognition (OCR) on images uploaded to Google Drive, summarize the content with OpenRouter AI, and log results to Google Sheets, completing the loop with a Gmail notification. Perfect for digitizing documents.

Use this powerful n8n workflow to automate receipt and table data extraction using OCR.space. This n8n templates guide explains the n8n trigger and data processing logic for accurate digitization.

Use this n8n workflow to automate the extraction of transaction details from Thai bank slip images received via LINE using SpaceOCR, saving structured data directly to Google Sheets for accounting.









































