workflows.fit
Back to n8n workflows
n8n templateFreeBy Raquel Giugliano

Automated invoice processing with Telegram, GPT-4o, OCR and SAP integration

++HOW IT WORKS:++ This workflow automates the processing of invoices sent via Telegram. It extracts the data using LlamaIndex OCR, logs it in Google Sheets, and optionally pushes the structured data to SAP Business On...

Data & StorageProductivityDevelopmentCore NodesCommunicationHITLAILangchain
Loading interactive preview...

Template notes

++HOW IT WORKS:++ This workflow automates the processing of invoices sent via Telegram. It extracts the data using LlamaIndex OCR, logs it in Google Sheets, and optionally pushes the structured data to SAP Business One

🔹 1. Receive Invoice via Telegram: - A user sends a PDF of an invoice through Telegram - A Telegram Trigger node listens for incoming messages and captures the file and metadata - The document is downloaded and prepared for OCR

🔹 2. OCR with LlamaIndex: - The file is uploaded to the LlamaIndex OCR API. - The workflow polls the API until the processing status returns SUCCESS - Once ready, the parsed content is fetched in Markdown format

🔹 3. Data Extraction via LLM (editable): - The Markdown content is sent to a language model (LLM) using LangChain - A Structured Output Parser transforms the result into a clean, structured editable JSON

🔹 4. Save to Google Sheets: The structured JSON is split into: 1. Header (main invoice metadata) 1. Detail (individual line items)

Each part is stored in a dedicated tab within a connected Google Sheets file

🔹 5. Ask for SAP Confirmation: The bot replies to the user via Telegram:

"Do you want to send the data to SAP?"