Document Data Extraction using Mistral OCR and OpenAI Agents - n8n Workflow

Use this powerful n8n workflow to automate complex document parsing, utilizing Mistral OCR for extraction, structured data generation via specialized AI agents, and automated delivery through Telegram. A comprehensive n8n template for data processing.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Finance & Operations Teams: Requiring automated invoice or receipt parsing and verification.
n8n Automation Specialists: Looking for advanced examples of integrating external APIs (like Mistral) with Langchain AI agents within an n8n workflow.
Data Engineers: Needing to convert unstructured document uploads into standardized, machine-readable formats.
Users of n8n templates: Seeking robust, multi-stage data processing solutions.

Overview

This advanced n8n workflow demonstrates robust multi-stage document processing, transforming an uploaded file (e.g., PDF or image) into a formatted, verified data report. The solution addresses the challenge of accurately extracting information from unstructured documents by leveraging the powerful OCR capabilities of the Mistral API via specialized HTTP requests. Following extraction, the data flows through two distinct AI Agents, powered by both the Mistral Cloud Chat Model and the OpenAI Chat Model, ensuring accurate structuring, verification, and summarization. This comprehensive n8n node configuration ensures reliability and accuracy before delivering the final, readable output report via Telegram. This is a highly valuable n8n template for anyone dealing with high-volume document ingestion.

How it Works

The n8n workflow initiates when a file is ready for processing (potentially acquired via a Telegram Trigger or similar input source, leading to the Download File n8n node).


  1. File Acquisition and Upload: The initial file is downloaded via an HTTP Request n8n node. A subsequent Code n8n node prepares the data for submission. The file is then sent to the Mistral API using a specific HTTP Request node (send pdf to Mistral).

  2. OCR and Data Retrieval: The workflow utilizes another HTTP Request (mistral - get signed url) to obtain access to the parsed data, followed by a final request (Get Parsed Invoice) to fetch the structured OCR result from the Mistral service.

  3. Primary AI Structuring: The raw extracted data is fed into the first AI Agent. This agent, utilizing the Mistral Cloud Chat Model1, analyzes the text and converts it into a more structured format, often focused on key fields like vendor, date, and totals.

  4. Formatting and Review: Set n8n nodes (Edit Fields) are used for cleanup, and a Markdown n8n node formats the output into a human-readable report.

  5. Secondary AI Verification: The formatted data then enters a second AI layer, the AI Agent1, which leverages the OpenAI Chat Model. This step performs final checks, summarization, or classification based on the extracted details, enhancing the reliability of the n8n workflow output.

  6. Delivery: The final, verified report is published to the designated channel using the Telegram n8n node (Telegram1), and a separate confirmation message can be sent (Send Confirmation).

Installation Guide

To deploy this powerful n8n template:


  1. Import the JSON: Copy the provided n8n workflow JSON and import it directly into your n8n canvas.

  2. Set up Credentials: You will need credentials for the following services:

Mistral API: Required for the three HTTP Request n8n nodes interacting with the Mistral OCR service (send pdf to Mistral, mistral - get signed url, Get Parsed Invoice). Configure these requests with the appropriate API keys and endpoints.
OpenAI: Required for the OpenAI Chat Model used by the second AI agent.
* Telegram: Required for the Telegram Trigger (if used) and the Telegram output n8n nodes.

  1. Webhook Activation: Ensure the Telegram Trigger (if used) and other necessary triggers are correctly set up and active for the n8n workflow to run automatically upon input.

  2. Agent Configuration: Review the prompts and tools configured within the AI Agent and AI Agent1 n8n node instances to ensure they align with the specific document type you are parsing.

Node Details

Telegram Trigger (n8n trigger): The primary starting point of the n8n workflow, reacting to incoming messages or file uploads on Telegram.
Download File (HTTP Request n8n node): Responsible for fetching the document (PDF/Image) from its source URL, making the file available in the n8n environment.
send pdf to Mistral / mistral - get signed url / Get Parsed Invoice (HTTP Request n8n nodes): These critical n8n nodes manage the asynchronous communication with the external Mistral API, handling the file upload, polling for completion, and finally downloading the structured OCR data.
AI Agent (Langchain Agent n8n node): The first layer of AI processing. Paired with the Mistral Cloud Chat Model1, it takes the raw OCR text and structures it based on predefined rules or prompts.
Mistral Cloud Chat Model1 (n8n node): Provides the large language model backend for the primary AI Agent, leveraging Mistral's capabilities for complex data extraction.
Markdown (n8n node): Formats the structured data into a clean, readable Markdown string, ready for human consumption or further AI processing.
AI Agent1 (Langchain Agent n8n node): The secondary AI layer. Powered by the OpenAI Chat Model, it performs final verification, summary generation, or categorization of the extracted data.
OpenAI Chat Model (n8n node): Supplies the OpenAI LLM capabilities to the second agent, often used here for robust verification or text manipulation.


  • Telegram1 / Send Confirmation (Telegram n8n nodes): The final action nodes that deliver the parsed, verified document summary back to the user or team via Telegram. This completes the automated n8n workflow.

Related n8n Workflows

Paid

Nodes: 12 Nodes
Updated: December 26 2025
View all
Created by
Mani
Mani

Experienced n8n workflow builder with a strong background in automation, API integrations, and process optimization. I've created efficient, scalable workflows across various platforms and use cases. Passionate about streamlining tasks and building smart, reliable solutions using n8n’s full capabilities.

Featured*