Process Telegram invoice OCR with OCR.space, OpenAI, Sheets and Drive
Ready for 3.0What this workflow does
This AI workflow has 16 nodes and runs on Telegram events (message). Along the way it connects Telegram, OpenAI Chat Model, Google Sheets and Google Drive. It also calls api.ocr.space over HTTP.
How it runs
Trigger: On Telegram events (message).
- Download Telegram Invoice File (Telegram): work with file
- Detect File Type (Code): runs custom JavaScript code
- Route Supported File Types (Switch): routes items into 3 branches
- Merge: merges the data from its input branches
- Extract Invoice Text with OCR.space (HTTP Request): calls api.ocr.space (POST)
- Upload Original Invoice to Google Drive (Google Drive): uses Google Drive
- Extract Structured Invoice Data (AI Agent): runs an AI agent, with model: OpenAI Chat Model; output parser: Validate Invoice JSON Output
- Prepare Confirmation Message Data (Edit Fields (Set)): sets 2 fields: Invoice Detail, file
- Format Invoice Fields for Sheets (Code): runs custom JavaScript code
- Write Telegram Confirmation Message (AI Agent): runs an AI agent, with model: OpenAI Chat Model
…plus 3 more steps. See the full node list below.
Services it uses
HTTP calls to: api.ocr.space
Before you upgrade to n8n 3.0
Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.
Nodes used (12)
- Edit Fields (Set)
n8n-nodes-base.set - Telegram Trigger
n8n-nodes-base.telegramTrigger - Telegram
n8n-nodes-base.telegram - Code
n8n-nodes-base.code - Switch
n8n-nodes-base.switch - HTTP Request
n8n-nodes-base.httpRequest - AI Agent
@n8n/n8n-nodes-langchain.agent - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured - Google Sheets
n8n-nodes-base.googleSheets - Merge
n8n-nodes-base.merge - Google Drive
n8n-nodes-base.googleDrive
From the author
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…