See llms.txt for all machine-readable content.

Back to Templates

Track supplier bills and missing invoices with Gmail, OpenAI, Sheets and Telegram

Quick overview

This workflow runs hourly to capture supplier bill PDFs from Gmail, extract key fields with OpenAI, and log them to Google Sheets with Telegram alerts for duplicates or anomalies, then runs every morning to learn supplier billing rhythms from the sheet and alert when expected bills are missing.

How it works

  1. Runs on two schedules: hourly to process incoming bill emails and daily to check for missing expected bills.
  2. Searches Gmail for matching emails, downloads PDF attachments, and skips files already logged in the Google Sheets Bills tab.
  3. Extracts text from each PDF and sends readable documents to OpenAI to return structured bill data (supplier, dates, currency, totals, category, and confidence).
  4. Validates and classifies each document as OK, Needs review, Duplicate, or Ignored by checking missing fields, total consistency, AI confidence, duplicates, and unusual price jumps against prior bills.
  5. Appends one row per processed file to the Google Sheets Bills tab and sends a Telegram message for any item that needs review, is a duplicate, or (optionally) every OK bill.
  6. Each morning, reads approved bills from Google Sheets to compute per-supplier billing frequency and usual totals, updates the Suppliers tab, and sends a Telegram alert once per overdue expected bill.

Setup

  1. Connect credentials for Gmail, Google Sheets, Telegram, and OpenAI (Chat Completions) used by the workflow.
  2. Create a Google Sheets spreadsheet with Bills and Suppliers tabs using the headers expected by the append/update steps, and paste your spreadsheet URL/ID into all Google Sheets nodes.
  3. In the Configuration step, set your Telegram chat ID, timezone, default currency, and adjust the Gmail search query and processing limits as needed.
  4. Ensure the Gmail query matches only bill-related emails with PDF attachments, and add any sender domains to ignoreSenders if required.
  5. Review rows marked Needs review in the Bills tab (for scanned PDFs or low-confidence/missing data) and set the Status to Reviewed once corrected.