Skip to main content

Process Telegram invoice OCR with OCR.space, OpenAI, Sheets and Drive

Workflow preview

Workflow preview
100%
Process Telegram invoice OCR with OCR.space, OpenAI, Sheets and Drive preview
Open on n8n.io

1. Workflow Overview

Quick overview This workflow accepts invoice files via a Telegram bot, extracts text with OCR.space, uses OpenAI to turn the OCR output into structured invoice fields, appends the data to Google Sh...

Best for

  • Invoice Processing automation workflows
  • AI Summarization automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.stickynote, n8n-nodes-base.set, n8n-nodes-base.telegramtrigger, n8n-nodes-base.telegram, n8n-nodes-base.code, n8n-nodes-base.switch, n8n-nodes-base.httprequest, @n8n/n8n-nodes-langchain.agent

Source and attribution

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

Original n8n.io source

1.1 Workflow description

Title
Process Telegram invoice OCR with OCR.space, OpenAI, Sheets and Drive
Workflow name
Process Telegram invoice OCR with OCR.space, OpenAI, Sheets and Drive

Quick overview

This workflow accepts invoice files via a Telegram bot, extracts text with OCR.space, uses OpenAI to turn the OCR output into structured invoice fields, appends the data to Google Sheets, archives the original file in Google Drive, and sends a confirmation message back to Telegram.

How it works

  1. Triggers when a user sends an invoice image (JPG/PNG) or PDF to your Telegram bot.
  2. Downloads the file from Telegram, detects its MIME type, and continues only for JPG, PNG, or PDF invoices.
  3. Sends the invoice file to OCR.space to extract the raw text content.
  4. Uses OpenAI to convert the OCR text into structured invoice JSON and validates the output against a predefined schema.
  5. Formats item lines into newline-separated fields and appends the invoice details to a Google Sheets worksheet.
  6. Uploads the original invoice file to a specified Google Drive folder and generates a short confirmation message with key details and your database link.
  7. Sends the confirmation message back to the same Telegram chat.

Setup

  1. Create a Telegram bot, add the Telegram credentials in n8n, and start a chat with the bot so it can receive messages.
  2. Add an OCR.space API key using HTTP Header Auth credentials and connect it to the OCR request step.
  3. Add OpenAI API credentials for the model used to extract structured invoice data and write the confirmation message.
  4. Connect Google Sheets and Google Drive OAuth credentials, then set the Google Sheet ID and Drive folder ID in the workflow variables.
  5. Create a Google Sheet (for example, “Sheet1”) with the required column headers used by the append step and update the sheet name if different.
  6. Set the invoice database link in the workflow variables so it can be included in the Telegram confirmation.

Requirements

  • Telegram Bot (created via BotFather)
  • OpenAI API key
  • OCR.space API key (free tier available at ocr.space)
  • Google Sheets OAuth2 credentials
  • Google Drive OAuth2 credentials

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 - Sticky Note 8c54e987

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

Block 2 - Sticky Note e29290ec

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

Block 3 - Configure Workflow Variables

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

Block 4 - Receive Invoice in Telegram

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

Block 5 - Download Telegram Invoice File

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

Block 6 - Detect File Type

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

Block 7 - Route Supported File Types

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

Block 8 - Extract Invoice Text with OCR.space

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

Block 9 - Extract Structured Invoice Data

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 3.1

Block 10 - OpenAI Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.3

Block 11 - Validate Invoice JSON Output

Type / Role
@n8n/n8n-nodes-langchain.outputParserStructured - outputParserStructured
Config choices
Version 1.3

Block 12 - Format Invoice Fields for Sheets

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

Block 13 - Save Invoice Data to Google Sheets

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.7

Block 14 - Merge Invoice Data with Original File

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3.2

Block 15 - Upload Original Invoice to Google Drive

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

Block 16 - Prepare Confirmation Message Data

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

Block 17 - Write Telegram Confirmation Message

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 3.1

Block 18 - Send Confirmation to Telegram

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

Block 19 - Sticky Note

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

Block 20 - Sticky Note1

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

Block 21 - Sticky Note2

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

Block 22 - Sticky Note3

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

3. Summary Table

Workflow Process Telegram invoice OCR with OCR.space, OpenAI, Sheets and Drive
Complexity advanced
Nodes 22
Categories Invoice Processing, AI Summarization
Author ayo.o
Published 14 Jun 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/16350/16350.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 Process Telegram invoice OCR with OCR.space, OpenAI, Sheets and Drive do?

Quick overview This workflow accepts invoice files via a Telegram bot, extracts text with OCR.space, uses OpenAI to turn the OCR output into structured invoice fields, appends the data to Google Sh...

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 Invoice Processing, AI Summarization use case.