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.
Download this n8n workflow template and start using it instantly.
Leveraging the simplicity of Telegram and the power of the Gemini 2.0 Flash model, this n8n workflow provides an elegant solution for high-speed Optical Character Recognition (OCR). The challenge of integrating binary files (images) uploaded via a chat application into a secure REST API is solved entirely within this n8n automation. When a user uploads an image, the system automatically fetches the file, converts it into the necessary Base64 format, sends it to the Gemini API for text extraction, and returns the result instantly. This comprehensive n8n node sequence ensures reliable and efficient data processing, making it one of the most useful n8n templates for AI adoption.
The execution of this n8n workflow follows a six-step process, initiated by an external event:
chatID (for sending the response) and the fileid of the highest resolution image uploaded.fileid to download the actual image file from Telegram's servers.data property—a format required by the Gemini API for inline data transfer.gemini-2.0-flash:generateContent endpoint with the prompt “Extract text”. The authentication is handled using a Query Auth credential.chatID to send the extracted text content back to the user who originally submitted the image, completing the entire n8n workflow loop.To deploy this powerful n8n workflow, follow these steps:
AIzaSy...). Create a new HTTP Query Auth credential in n8n, setting the parameter name to key and the value to your Gemini API key. This credential is used by the 'Gemini OCR' n8n node.This n8n workflow relies on a precise configuration of standard and specialized n8n node types:
Telegram Trigger (n8n trigger):
Function: Starts the n8n workflow upon receiving an image message.
Key Configuration: Configured to monitor 'message' updates and enable Download to ensure file metadata is available.
Clean Input Data (Set n8n node):
Function: Extracts the user's chatID and the fileid of the highest resolution image to be processed.
Key Configuration: Uses N8N expressions to dynamically select the largest file in the photo array: ={{ $json["message"]["photo"][$json["message"]["photo"].length - 1]["fileid"] }}.
get file (Telegram n8n node):
Function: Retrieves the binary content of the image file using the previously extracted fileId.
Key Configuration: Resource set to 'file'.
Extract from File (n8n node):
Function: Prepares the binary file for API transmission by encoding it to Base64 and mapping it to a JSON property, making it consumable by the HTTP Request body.
Key Configuration: Operation set to 'binaryToPropery'.
Gemini OCR (HTTP Request n8n node):
Function: Sends the Base64-encoded image and the extraction prompt to the Gemini 2.0 Flash API.
Key Configuration: URL points to the gemini-2.0-flash:generateContent endpoint. Uses JSON body structure containing inlineData for the image and Query Auth for API key inclusion.
Telegram (n8n node):
Function: Sends the final extracted text result back to the initiating user.
Key Configuration: Uses the stored chatID and the output from the Gemini request (={{ $json.output }}) as the message text.
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.

Automate task creation from Telegram messages to Notion using Gemini AI. This n8n workflow template uses approval steps for efficient, human-verified task management.

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.

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.









































