Makani Tech: Build. Automate. Evolve.

Telegram Expense Tracker with n8n + Gemini (free workflow)

Send a receipt photo or a quick text to your Telegram bot. Gemini reads it, logs the expense in Google Sheets and tells you your month total.

FreeWorkflowBy Kishan Makani · updated 28 October 2026 · 6 min read

TelegramGeminiGoogle Sheets

Downloads

  • Download the n8n workflow (JSON)

    telegram-expense-tracker-n8n-gemini.json · n8n workflow · 18 steps · starts with Receive Telegram Message · uses Telegram, Google Gemini, Google Sheets, Summarize · 31 KB

    Import into n8n: Create Workflow, then the menu, then Import from File.

How to import it into n8n
  1. In n8n, create a new workflow.
  2. Open the ⋯ menu at the top right and choose Import from File, then pick the downloaded .json. (Or open the file, copy everything and paste it on the canvas.)
  3. Open each node with a warning and connect your own account: the file carries no passwords or keys.
  4. Run it once with Test workflow, check the result, then switch it to Active.

What this workflow does

Stop losing bills and rebuilding expenses at month end. Your team sends a photo of any bill or receipt to a Telegram bot, or just types "450 petrol HP pump UPI". Gemini reads the date, shop, amount, category and payment method, the expense is saved as a new row in Google Sheets, and the bot replies in seconds with what it saved and how much of this month's budget is used.

  1. Receive Telegram Message starts the workflow when someone messages your bot. Photos are downloaded in large size.
  2. Workflow Configuration holds your allowed Telegram user IDs, default currency, category list and monthly budget. Allow Only Team Members drops messages from anyone else.
  3. Photo or Text? sends receipt photos to Read Receipt Photo with AI and typed messages to Read Typed Expense with AI. Both use Gemini with a structured output parser, so they always return the same fields: isExpense, date, merchant, amount, currency, category, paymentMethod and description. Stickers, voice notes and files go straight to a help reply.
  4. Prepare Expense Row cleans the result (valid date or today, amount rounded to 2 decimals, defaults for missing fields, who sent it, photo or text). Is It a Valid Expense? only lets through items that are an expense with an amount above 0.
  5. Save Expense to Google Sheets appends the row. Get This Month's Expenses reads every row with the same Month, Add Up This Month sums the Amount column, and Send Confirmation on Telegram replies to the original message with the saved details, the month total and a warning at 80% and 100% of the budget.
  6. If Gemini fails, Could Not Read Expense takes the error output, and Ask User to Try Again asks for a clearer photo or a typed expense. The same node answers greetings and anything that is not an expense, so nothing junk is saved.

Who it is for

Small business owners, shop and restaurant owners, agencies, field sales and service teams, contractors, freelancers and anyone who wants a clean expense sheet without an expense app.

What you need

  • n8n (Cloud or self-hosted)
  • A Telegram account and a bot token from @BotFather (free)
  • A Google account with Google Sheets
  • A Google Gemini API key (the free tier covers a small team's daily bills)
  • Your n8n instance must be reachable over HTTPS so Telegram can deliver messages

The workflow, step by step

Step 1 · Receive the expense

Checks the sender and splits photos from text.

  • Receive Telegram Message (Telegram Trigger)
  • Workflow Configuration (Set)
  • Allow Only Team Members (Filter)
  • Photo or Text? (Switch)

Step 2 · Read it with Gemini

Reads the bill photo or the typed text.

  • Gemini Model for Photos (Gemini model)
  • Gemini Model for Text (Gemini model)
  • Read Receipt Photo with AI (Basic LLM Chain)
  • Read Typed Expense with AI (Basic LLM Chain)
  • Expense Fields from Photo (Structured Output Parser)
  • Expense Fields from Text (Structured Output Parser)
  • Could Not Read Expense (Set)

Step 3 · Check and save

Cleans the fields and saves real expenses.

  • Prepare Expense Row (Set)
  • Is It a Valid Expense? (IF)
  • Save Expense to Google Sheets (Google Sheets)

Step 4 · Reply with the month total

Adds up this month and confirms on Telegram.

  • Get This Month's Expenses (Google Sheets)
  • Add Up This Month (Summarize)
  • Send Confirmation on Telegram (Telegram)

Step 5 · Ask to try again

When there's no clear amount or AI fails.

  • Ask User to Try Again (Telegram)

Setup

  1. Download the JSON below and import it in n8n (Create workflow > ⋯ > Import from File).
  2. In Telegram, talk to @BotFather, create a bot and copy its token into a new Telegram API credential in n8n.
  3. Create a Google Sheet with a tab named Expenses and these headers in row 1: Date, Month, Merchant, Amount, Currency, Category, Payment Method, Description, Added By, Source, Logged At.
  4. Add Google Sheets OAuth2 and Google Gemini (PaLM) API credentials, and pick your spreadsheet in Save Expense to Google Sheets and Get This Month's Expenses.
  5. Get each team member's Telegram user ID (they can message @userinfobot) and paste them, comma separated, into allowedUserIds in Workflow Configuration. Set your currency, categories and monthly budget there too.
  6. Activate the workflow and send the bot a bill photo to test.
  7. Test it: activate, then send the bot "450 petrol HP pump UPI". Expect a new row with Amount 450 and Category Fuel, and a reply with the month total. Then send a clear bill photo.

How to customise

  • The sample prompts and bot replies are a starting point, not a fixed format. Rewrite them for your business.
  • Read Receipt Photo with AI, Read Typed Expense with AI: extraction rules
  • Send Confirmation on Telegram, Ask User to Try Again: bot replies
  • categories, monthlyBudget, defaultCurrency: your books
  • Add or rename categories in categories; the AI only picks from this list.
  • Change monthlyBudget, or set it to a very large number to turn off the warning.
  • For faded, long or handwritten bills, switch Gemini Model for Photos to a larger Gemini model.
  • Use it in a Telegram group: add the bot to the group and keep everyone's user ID in allowedUserIds; replies go to the same chat.
  • Save the bill image too: add a Google Drive upload node on the photo branch and a Receipt Link column.

Why Gemini

Gemini 3.1 Flash-Lite (models/gemini-3.1-flash-lite, temperature 0) for both the photo and the text path. This task is reading a photo (OCR plus understanding the layout of an Indian bill, GST line and total) and turning it into fixed fields. Gemini is natively multimodal and strong on printed and mixed-language text, it reads typed Hinglish like "chai samosa 120 cash" well, and its free tier and low price matter because a team may send dozens of bills a day. Temperature 0 and a structured output parser keep the fields stable, and the prompt forbids guessing an amount. Claude and GPT-4-class models also read receipts well, but cost more per image for no clear gain on this simple extraction, and neither has a free API tier. If your bills are often faded or handwritten, a larger Gemini model is the first thing to try.

Guardrails

  • Add user IDs first: Until allowedUserIds holds your Telegram IDs, every message is ignored.

Troubleshooting

  • Credential errors after import: imported workflows never include credentials. Open each node marked red and select your own account.
  • Nothing runs on its own: test runs only fire once. Activate the workflow so the trigger keeps running.
  • Odd times or dates: set your timezone in Workflow Settings.

Want the members-only resources too?

A free account unlocks them all, including the ones shared in DMs.

Create a free account