Quick overview
This workflow polls Gmail for unread emails with attachments, extracts invoice fields using easybits Extractor, deduplicates by invoice number, logs new invoices to Google Sheets, and sends a Telegram alert with key totals.
How it works
- Triggers every minute by polling Gmail for unread emails and downloading their attachments.
- Filters out small inline/junk files (under 10 KB) and splits each remaining attachment into its own item for processing.
- Iterates through attachments, marks the source email as read in Gmail, and keeps only supported file types (PDF, JPEG, PNG, WebP).
- Sends each supported attachment to easybits Extractor to classify the document and extract invoice fields like vendor, invoice number, and totals.
- Continues only when the extracted document is classified as an invoice and looks up the invoice number in Google Sheets.
- Appends a new row to Google Sheets for invoices not already present and sends a formatted Telegram message with the vendor and amounts.
Setup
- Connect a Gmail OAuth2 credential and ensure the workflow has access to the mailbox you want to monitor.
- Add an easybits Extractor credential and configure your extractor pipeline to return document_class, invoice_number, vendor_name, service_name, service_period, total_net, vat_amount, and total_gross.
- Connect a Google Sheets credential, replace YOUR_GOOGLE_SHEET_ID, and ensure the target sheet tab contains matching column headers (for example, invoice_number, vendor_name, total_gross).
- Connect a Telegram bot credential and replace YOUR_TELEGRAM_CHAT_ID with your chat or channel ID.