Log receipt expenses in Notion with Gmail, Telegram, and OpenAI
Quick overview This workflow captures receipt attachments from Gmail and receipt photos from Telegram, extracts structured expense details with OpenAI (gpt-4o-mini), logs each expense as a new page in a Notion database, and sends a Telegram confirmation, with Slack and Telegram alerts on workflow errors.
How it works Triggers when a new Gmail message matching the receipt search filter arrives with an attachment. Extracts the first email attachment, detects whether it is a PDF, and if it is a PDF extracts its text content. Sends either the PDF text or the receipt image to OpenAI (gpt-4o-mini) to return receipt data as JSON (vendor, date, amount, currency, category, summary). Triggers when a new Telegram message is received and continues only if it includes a photo. Downloads the highest-resolution Telegram photo, converts it to a base64 data URL, and sends it to OpenAI (gpt-4o-mini) for JSON receipt extraction. Parses the OpenAI response into normalized fields and creates a new expense entry in a Notion database. Sends a Telegram message confirming the logged expense, and on any workflow error posts alerts to Slack and Telegram.
Setup Add credentials for Gmail OAuth2, Telegram Bot API, OpenAI, Notion, and Slack OAuth2 (for error alerts). Replace REPLACE_WITH_YOUR_NOTION_EXPENSES_DATABASE_ID with your Notion expenses database ID and ensure the database has matching properties (Vendor, Amount, Currency, Date, Category, Source, Notes). Set the Telegram chat IDs used for messages by replacing REPLACE_WITH_YOUR_TELEGRAM_CHAT_ID in the confirmation step and YOUR_ADMIN_TELEGRAM_CHAT_ID for error alerts. Update the Slack channel selection for error alerts to the channel you want to receive workflow failure notifications. Configure your Telegram bot with BotFather and start a chat with the bot so it can receive photos and send confirmations. Activate both the Gmail and Telegram triggers.
Related Templates
Transform Gmail Newsletters into Insightful LinkedIn Posts Using OpenAI
Who Is This For? This workflow is perfect for content creators, marketers, and business professionals who receive regu...
Compare Lists and Identify Common Items & Differences Using Custom Keys
This workflow compares two lists of objects (List A and List B) using a user-specified key (e.g. email, id, domain) and ...
AI Email Classifier & Auto-Delete for Gmail (SPAM/OFFER Cleaner)
This workflow is designed for freelancers, solopreneurs, and business owners who receive a high volume of irrelevant mes...
๐ Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments