Skip to main content

Extract text from images & PDFs via Telegram with Mistral OCR to Markdown

Workflow preview

Workflow preview
100%
Extract text from images & PDFs via Telegram with Mistral OCR to Markdown preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

This n8n template provides a complete solution for Optical Character Recognition (OCR) of image and PDF files directly within Telegram Users can simply send PNG, JPEG, or PDF documents to your Tele...

Best for

  • Document Extraction automation workflows
  • Multimodal AI automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.if, n8n-nodes-base.stickynote, n8n-nodes-base.httprequest, n8n-nodes-base.set, n8n-nodes-base.switch, n8n-nodes-base.telegram, n8n-nodes-base.code, n8n-nodes-base.converttofile

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Rostislav.

Original n8n.io source

1.1 Workflow description

Title
Extract text from images & PDFs via Telegram with Mistral OCR to Markdown
Workflow name
Extract text from images & PDFs via Telegram with Mistral OCR to Markdown

This n8n template provides a complete solution for Optical Character Recognition (OCR) of image and PDF files directly within Telegram


Users can simply send PNG, JPEG, or PDF documents to your Telegram bot, and the workflow will process them, extract text using Mistral OCR, and return the content as a downloadable Markdown (.md) text file.

Key Features & How it Works:

  • Effortless OCR via Telegram: Users send a file to the bot, and the system automatically detects the file type (PNG, JPEG, or PDF).
  • File Size Validation: The workflow enforces a 25 MB file size limit, in line with Telegram Bot API restrictions, ensuring smooth operation.
  • Mistral-Powered Recognition: Leveraging Mistral OCR, the template accurately extracts text from various document types.
  • Markdown Output: Recognized text is automatically converted into a clean Markdown (.md) text file, ready for easy editing, storage, or further processing.
  • Secure File Delivery: The processed Markdown file is delivered back to the user via Telegram. For this, the workflow ingeniously uses a GET request to itself (acting as a file downloader proxy). This generated link allows Telegram to fetch the .md file directly. Please note: This download functionality requires the workflow to be in an Active status.
  • Optional Whitelist Security: Enhance your bot's security with an optional whitelist feature. You can configure specific Telegram User IDs to restrict access, ensuring only authorized users can interact with your bot.
  • Simplified Webhook Management: The template includes dedicated utility flows for convenient management of your Telegram bot's webhooks (for both development and production environments).

This template is ideal for digitizing documents on the go, extracting text from scanned files, or converting image-based content into versatile, searchable text.

Getting Started

To get this powerful OCR bot up and running, follow these two main steps:

  1. Set Up Your Telegram Bot: First, you'll need to configure your Telegram bot and its webhooks. Follow the instructions detailed in the Telegram Bot Webhook Setup section to create your bot, obtain its API token, and set up the necessary webhook URLs.

  2. Configure Bot Settings: Next, you'll need to define key operational parameters for your bot. Proceed to the Settings Configuration section and populate the variables according to your preferences, including options for whitelist access.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Image / PDF

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 2 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 3 - Sticky Note8

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 4 - Mistral OCR

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 5 - Settings

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 6 - Telegram Event Handler

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 3

Block 7 - Status “Typing…”

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 8 - Sticky Note9

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 9 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 10 - Notification about correct commands

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 11 - Maximum file size exceeded

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 12 - Checking file size

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 13 - File classifier

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 14 - Generating temporary file link

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 15 - Invalid file

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 16 - Markdown converter

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 17 - Converting Markdown to File

Type / Role
n8n-nodes-base.convertToFile - convertToFile
Config choices
Version 1.1

Block 18 - Manual Webhook Setup Trigger

Type / Role
n8n-nodes-base.manualTrigger - manualTrigger
Config choices
Version 1

Block 19 - Telegram Webhook Configuration

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 20 - Check Production Mode

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 21 - Set Production Webhook

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 22 - Set Development Webhook

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 23 - Return Webhook Status

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 24 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Showing the first 24 of 40 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Extract text from images & PDFs via Telegram with Mistral OCR to Markdown
Complexity advanced
Nodes 40
Categories Document Extraction, Multimodal AI
Author Rostislav
Published 20 Jul 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/6209/6209.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Extract text from images & PDFs via Telegram with Mistral OCR to Markdown do?

This n8n template provides a complete solution for Optical Character Recognition (OCR) of image and PDF files directly within Telegram Users can simply send PNG, JPEG, or PDF documents to your Tele...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Document Extraction, Multimodal AI use case.