Track receipt expenses from Telegram using Google Gemini and Google Sheets
Quick overview Youtube Video: https://youtu.be/7GqvPmAHm1A
This workflow captures receipt photos sent to a Telegram bot, uses Google Gemini (via an AI agent) to extract structured expense details, checks Google Sheets for duplicates by message ID, and either warns about duplicates or appends the expense and replies with a confirmation summary.
How it works Triggers when a new message is received by your Telegram bot. Normalizes the incoming Telegram payload and checks whether the message includes a receipt photo. If no photo is attached, sends a Telegram reply asking the user to upload a clear receipt image. If a photo is attached, downloads the image from Telegram and sends it to Google Gemini to extract receipt fields as JSON. Parses and validates the extracted data (including a confidence score) and flags the receipt for review if key fields are missing or uncertain. Looks up the Telegram message ID in a Google Sheets “Expenses” sheet to detect whether the receipt has already been logged. If it is a duplicate, sends a duplicate notice via Telegram; otherwise appends the expense to Google Sheets and sends a formatted summary back to the user.
Setup Create a Telegram bot with BotFather, add your Telegram credentials in n8n, and ensure the workflow is allowed to receive messages from your bot. Add Google Gemini (Google PaLM) API credentials for the Google Gemini chat model used by the AI agent. Add Google Sheets OAuth2 credentials and set the target spreadsheet and “Expenses” sheet in the Google Sheets nodes. Ensure your “Expenses” sheet includes a column named messageId (and optionally the other mapped columns like merchant, receiptDate, total, and receiptId) so duplicate detection and appends work correctly.
Related Templates
Track Demo Bookings with Google Calendar to Meta Conversions API Integration
Who is this workflow for? If you're using Meta Ads to generate new leads to your sales pipeline, this workflow is for yo...
Build an MCP Server which answers questions with Retrieval Augmented Generation
Build an MCP Server which has access to a semantic database to perform Retrieval Augmented Generation (RAG) Tutorial C...
Transcribe & Summarize Audio with Whisper and GPT, from Google Drive to Notion
This workflow contains community nodes that are only compatible with the self-hosted version of n8n. Overview This work...
🔒 Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments