⚡ Personal finance tracker with Telegram Bot, Google Gemini Vision, and Sheets

1,971 views · ⚡ Personal Productivity

Description

Personal Finance AI Agent – Telegram Bot (n8n Workflow)

A fully automated Telegram-based personal finance tracker that:

Built entirely with n8n – 100% self-hostable, no-code/low-code.


How It Works (Overview)

  1. You send a message to your Telegram bot
    → Photo of a receipt, PDF, or just text like “Nov 10 – 2500 NGN – Uber”

  2. Switch node detects the message type:

    • Photo → Branch 0
    • Document (PDF/other) → Branch 1
    • Pure text → Branch 2 (goes straight to query agent)
  3. Receipt Processing Path (Images & PDFs)

    • Files downloaded from Telegram → uploaded to Google Drive (“Monthly receipts” folder)
    • Images → OCR with Gemini Vision
      PDFs → native PDF text extraction
    • Extracted text + Drive link → merged → sent to Gemini AI Agent
    • AI extracts: Date (YYYY-MM-DD) • Amount (NGN) • Description • Category
      (food, transportation, subscriptions, takeouts, entertainment, gift, electricity, repairs, other stuffs)
    • Clean JSON → appended to Google Sheets → friendly confirmation sent back
  4. Spending Query Path (Text questions)

    • Second AI Agent with access to the live Google Sheet + calculator + memory
    • Answers anything: totals, breakdowns, comparisons, trends, percentages…

Live Google Sheet (Template)

You can make a copy of the exact sheet the bot uses:
https://docs.google.com/spreadsheets/d/1kwWJquPpwL9vt9U06a4f4phXq5jZjaGazvh2V69FGoc/edit?usp=sharing

Just click File → Make a copy and use your copy’s ID in the workflow.


Setup Steps (Step-by-Step)

Prerequisites

1. Create Telegram Bot

  1. Message @BotFather → /newbot
  2. Copy the bot token
  3. In n8n → Credentials → New Telegram API credential → paste token

2. Google Setup

  1. Make a copy of the sheet above
    → Copy the new spreadsheet ID from the URL
  2. Create a Google Drive folder called “Monthly receipts” (or any name) → copy folder ID
  3. Enable Gemini API in Google Cloud (or use your existing key)
  4. In n8n create these credentials:
    • Google Sheets OAuth2 API
    • Google Drive OAuth2 API
    • Google Gemini (PaLM) API

3. Import Workflow

4. Update IDs & Credentials

After import, configure these nodes:

NodeWhat to Change
Telegram Trigger + all Telegram nodesYour Telegram credential
Google Sheets nodesYour Google Sheets credential + new Sheet ID
Google Drive “Upload file” nodesPaste your “Monthly receipts” folder ID
Gemini nodesYour Gemini credential
AI Agent & AI Agent1Verify model, memory, tools are connected

5. Activate & Test

Test commands

You’ll get instant replies and see new rows appear in your sheet!


Features

Never track expenses manually again!

🔗 Nodes Used

Google Sheets, Telegram, Telegram Trigger, Google Drive, AI Agent, Simple Memory

📥 Import

Download workflow.json and import into n8n: Workflow menu → Import from File

📖 Importing guide · 🔑 Credential setup