Skip to main content

Track invoice spending vs budget from Google Drive with GPT-4o and Telegram alerts

Workflow preview

Track invoice spending vs budget from Google Drive with GPT-4o and Telegram alerts preview
Open on n8n.io

Overview

Invoice Budget Tracker

Drop invoices to Google Drive and let AI handle the rest - OCR extraction, automatic categorization, budget tracking, and Telegram alerts when spending reaches thresholds.

โœจ Key Features

  • ๐Ÿ“„ Invoice OCR - Extracts data from PDF/image invoices automatically
  • ๐Ÿค– AI Categorization - Detects document type (skips contracts, delivery acts) and categorizes real invoices
  • ๐Ÿ’ฐ Budget Tracking - Set monthly budgets per category, track spending in real-time
  • ๐Ÿ”” Smart Alerts - Get notified when category spending reaches 80%+ of budget
  • ๐Ÿ“ Auto-Organization - Files renamed and sorted into monthly folders
  • ๐Ÿ”„ Deduplication - SHA256 hash prevents duplicate processing
  • ๐Ÿ“ˆ Scheduled Reports - Weekly progress (Fridays) and monthly summaries (10th)
  • ๐Ÿ’ฌ Telegram Control - Manage budgets via natural language chat

๐ŸŽฏ How It Works

  1. Drop invoice to Google Drive watched folder:
  • PDF invoices
  • Image scans (JPG, PNG)
  1. AI processes automatically (hourly):
  • OCR extracts text via Ainoflow
  • AI detects if it's actually an invoice (skips contracts, receipts, etc.)
  • Extracts: vendor, amount, date, invoice number
  • Categorizes based on service provided
  • Checks for duplicates
  1. Get organized:
  • File renamed: [2026-01-15] - Vendor (INV-123, 150.00 EUR).pdf
  • Moved to monthly folder: /Invoices/2026-01/
  • Budget updated, alerts sent if threshold reached
  1. Manage budgets via Telegram:
  • "Set budget Software 500"
  • "Show budgets"
  • "Budget status"

๐Ÿ“‹ Expense Categories

Software, Marketing, Travel, Office, Professional Services, Infrastructure, Vehicle, Other

๐Ÿ”ง Setup Requirements

  • Google Drive โ€” OAuth setup for file operations
  • Telegram Bot โ€” Create bot for notifications and budget management
  • OpenRouter โ€” Get API key for AI processing
  • Ainoflow โ€” Sign up for OCR and JSON storage

๐Ÿ—๏ธ Workflow Architecture

Section Description
Document Processing Hourly scan โ†’ OCR โ†’ AI categorization โ†’ Budget tracking โ†’ File organization
Budget Management Telegram bot for budget CRUD via AI Agent with MCP storage
Weekly Report Friday summary of current month progress
Monthly Report 10th of month detailed report for previous month
Data Reset Manual trigger to delete all invoice data (requires approval)

๐Ÿ’ฌ Usage Examples

Invoice Processing

๐Ÿ“„ Drop "invoice_aws.pdf" to /Invoices/
โ†’ โœ… AWS | 150.00 EUR | Software
โ†’ File: [2026-01-15] - AWS (INV-2026-01, 150.00 EUR).pdf
โ†’ Moved to: /Invoices/2026-01/

๐Ÿ“„ Drop "contract.pdf" to /Invoices/
โ†’ โš ๏ธ Skipped: This is a service agreement, not an invoice
โ†’ File renamed: [REVIEW] - contract.pdf

Budget Management (Telegram)

"Set budget Software 500"
โ†’ โœ… Budget set: Software - โ‚ฌ500/month

"Show budgets"
โ†’ ๐Ÿ“‹ Monthly Budgets:
 โ€ข Software: โ‚ฌ500
 โ€ข Marketing: โ‚ฌ1000
 Total: โ‚ฌ1500/month

"Budget status"
โ†’ ๐Ÿ“Š January 2026:
 โ€ข Software: โ‚ฌ150/โ‚ฌ500 (30%) โœ…
 โ€ข Marketing: โ‚ฌ850/โ‚ฌ1000 (85%) โš ๏ธ

Scheduled Reports

๐Ÿ“… Weekly (Friday):
โ†’ ๐Ÿ“Š Week Summary:
 Processed: 12 invoices
 Total: โ‚ฌ2,450
 Top: Software โ‚ฌ800, Marketing โ‚ฌ650

๐Ÿ“… Monthly (10th):
โ†’ ๐Ÿ“ˆ January 2026 Report:
 Total: โ‚ฌ4,200 (28 invoices)
 [โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘] Software 80%
 [โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘] Marketing 60%

๐Ÿ“ฆ Data Storage

Invoices stored in Ainoflow JSON Storage by month (key = SHA256 hash):

{
 "vendor": "Amazon Web Services",
 "vendor_normalized": "AWS",
 "amount": 150.00,
 "currency": "EUR",
 "date": "2026-01-15",
 "invoice_number": "INV-2026-01",
 "category": "Software",
 "file_id": "1BxiMVs0XRA5nFMd...",
 "processed_at": "2026-01-15T10:30:00Z"
}

โš ๏ธ Important Notes

  • Run /start first - Registers your chat_id, locks bot to you
  • Document type detection - Contracts, delivery acts, receipts are skipped automatically
  • Budget alerts at 80% - Only triggers if budget is set for category
  • Duplicates detected - Same file won't be processed twice (SHA256 hash)
  • Data Reset is permanent - Requires manual approval
  • Single currency - All invoices assumed same currency (no conversion)

๐Ÿ› ๏ธ Customization

Categories

Edit SetDefaults node โ†’ allowed_categories Then send /start to re-register with new categories

Processing Thresholds

Edit WorkflowConfig node:

  • alert_threshold - Budget alert % (default: 0.8)
  • review_prefix - Failed files prefix (default: "[REVIEW] - ")
  • duplicate_prefix - Duplicate prefix (default: "[DUPLICATE] - ")

AI Models

Swap OpenRouter models in Gpt4oCategorizer and Gpt4oBudgetAgent nodes

๐Ÿ’ผ Need Customization?

Want to adapt this template for your business? Custom integrations, multi-user support, or enterprise deployment?

Contact us at Ainova Systems - We build AI automation solutions for businesses.


Tags: google-drive, invoice-processing, budget-tracking, ai-agent, ocr, telegram, openrouter, mcp-tools, business-automation