Sitemap

AI-Powered Expense Tracker That You Can Use Just by Chatting

8 min readAug 28, 2026

--

Press enter or click to view image in full size

The Problem

This project started from a fairly simple personal problem:

I found it difficult to consistently track my expenses.

There are already plenty of expense-tracking applications available. Most of them offer much more functionality than I actually need: expense recording, budgeting, charts, reports, categories, and many other features.

But I found one problem with the experience.

Tracking an expense often feels like another task that I have to do.

I have to open the application, navigate to the expense section, choose a category, enter the amount, add a description, and save it until i eventually skip 1 transaction and 1 other transcation and 1 other transaction to not taking notes at all.

Some applications also include advertisements or other elements that make the experience less focused.

So I started thinking:

What if tracking expenses was as simple as sending a message to someone?

For example, instead of opening an application and filling out a form, I could simply send:

“I had nasi goreng for 15k rupiahs.”

The system should understand that I just made an expense.

That simple idea became the starting point for this project.

The Idea

I decided to build an AI-powered personal expense tracker inside Telegram.

The basic concept is:

Telegram as the interface, AI as the natural-language layer, PostgreSQL as the database, and AI again for financial analysis.

Instead of forcing users to interact with forms, the application allows them to communicate naturally.

For example:

“I had nasi goreng for 15k.”

“Add another 1 million to my budget.”

“How much budget do I have left?”

“What do you think about my spending this month?”

The AI interprets the message and converts it into a structured intent that the application can process.

Why Telegram?

I chose Telegram because I didn’t want to build another mobile application just to solve a relatively simple problem.

Besides, its FREE.

That means the interaction can be reduced from:

Open application
→ Find expense menu
→ Choose category
→ Enter amount
→ Enter description
→ Save

to:

Open Telegram
→ Send a message

For example:

“Bought coffee for 20k rupiahs.”

That’s it.

Telegram also provides a Bot API that makes it relatively straightforward to receive messages, process them, and send responses.

Using AI as a Natural Language Interface

Initially, the bot relied on traditional commands.

For example:

/expense 15000 makanan nasi padang

This approach works, but it requires users to remember the command structure.

I wanted the interaction to feel more natural, so I introduced an AI parser.

The AI’s job is not simply to “chat” with the user.

Instead, it converts natural language into structured information that the application understands.

For example:

User input

“I had nasi goreng for 20k.”

AI output

{
"is_financial": true,
"intent": "add_expense",
"amount": 20000,
"category": "makanan",
"description": "makan nasi goreng"
}

The application can then use that result to create the transaction in the database.

This makes the AI a natural-language interface for the application, rather than just a chatbot.

The Bot Does Not Respond to Every Message

One design decision I made was that the bot should not become a general-purpose chatbot.

For example, if I send:

“I’m really tired.”

The AI can classify it as:

{
"is_financial": false,
"intent": "other"
}

The bot doesn’t need to respond.

This distinction is important.

The purpose of the application is to help manage finances, not to respond to every conversation.

The AI is there when it provides value to the financial workflow.

Financial Intents

The AI parser currently recognizes several important intents.

1. Add Expense

For recording an expense.

Example:

“I spent 15k on nasi padang.”

The system extracts:

Amount      → 15,000
Category → Food
Description → Nasi padang

and stores it in PostgreSQL.

2. Set Budget

A user can define the budget for the current month.

For example:

“My budget this month is 5 million.”

The system stores the monthly budget.

I intentionally made the main budget-setting operation limited to once per month, so the budget cannot accidentally be overwritten every time the user mentions a different amount.

3. Add Budget

Sometimes the budget needs to be corrected or increased.

For example:

“Add another 1 million to my budget.”

If the original budget was:

Rp5,000,000

the new budget becomes:

Rp5,000,000 + Rp1,000,000
= Rp6,000,000

I separated set_budget and add_budget because replacing a budget and adding to a budget represent two different actions.

4. Summary

The summary feature provides factual information about the current month.

For example:

“How much budget do I have left?”

The application calculates:

  • Total budget
  • Total expenses
  • Remaining budget
  • Percentage of budget used
  • Number of transactions
  • Expenses grouped by category

This calculation is performed by the application and database rather than asking the AI to do basic arithmetic.

5. Analysis

Analysis is different from summary.

I think of it this way:

Summary  → What happened?
Analysis → What does it mean?

For example:

“What do you think about my spending this month?”

The application gathers the user’s financial data and sends the relevant information to the AI.

The AI then provides an interpretation of the user’s spending behavior.

This allows the system to go beyond simply displaying numbers.

Daily Financial Report

Another feature I wanted was to make the application proactive.

Instead of requiring me to remember to check my finances every day, the bot can generate a daily financial report automatically.

The workflow looks like this:

Scheduler
↓
Retrieve financial data
↓
Calculate summary
↓
Send relevant data to AI
↓
Generate analysis
↓
Send report to Telegram

The report can contain information such as:

  • Today’s spending
  • Total spending for the month
  • Remaining budget
  • Spending by category
  • Spending patterns
  • AI-generated observations

The idea is to turn the application from a simple expense recorder into a more proactive personal financial assistant.

Commands Are Still Available

Although natural language is the main interaction method, I decided to keep traditional commands as well.

Get Febry Ramadhan’s stories in your inbox

Join Medium for free to get updates from this writer.

For example:

/help
/expense
/budget
/addbudget
/summary
/analysis

This provides a deterministic fallback when users want explicit control.

The /help command also provides an overview of the available functionality and examples of how to use the bot.

So users can either use:

/expense 15000 makanan nasi padang

or simply:

“I had nasi padang for 15k.”

Both approaches can lead to the same result.

Multi-User Architecture

The project was designed with multiple users in mind from the beginning.

Each Telegram user has a unique Telegram ID, which is associated with their application user record.

Conceptually:

Telegram User
↓
Telegram ID
↓
User
↓
┌───────────────┐
│ Budgets │
│ Expenses │
└───────────────┘

This allows each user to have completely separate financial data.

User A should never receive User B’s expenses or budget.

Although the project started as a personal tool, designing it as a multi-user application from the beginning makes future expansion much easier.

Technology Stack

The current technology stack consists of:

Python

Python is the primary programming language.

It is used for the bot, application logic, database interaction, AI integration, and scheduled tasks.

FastAPI

FastAPI provides the backend/API layer.

Even though Telegram is currently the primary interface, having an API layer provides a foundation for future interfaces and integrations.

python-telegram-bot

This library handles the Telegram Bot API integration.

It is responsible for:

  • Receiving Telegram messages
  • Handling commands
  • Sending responses
  • Running the bot
  • Polling for updates

PostgreSQL + Supabase

The database is PostgreSQL, hosted using Supabase.

Supabase provides a convenient managed PostgreSQL environment without requiring me to maintain a database server myself.

The database stores information such as:

  • Users
  • Budgets
  • Expenses
  • Transaction data

SQLAlchemy

SQLAlchemy is used as the ORM/database abstraction layer.

This keeps database operations separated from the Telegram handlers and makes the application easier to maintain.

DeepSeek

DeepSeek is used for the AI components.

There are currently two major use cases:

Natural-language parsing

User message
↓
DeepSeek
↓
Intent + structured data

and:

Financial analysis

Financial data
↓
DeepSeek
↓
Financial insight

Docker

The application is containerized using Docker.

Docker helps keep the development and production environments consistent.

Docker Compose is also used during local development.

Railway

Railway is used to deploy the application and keep the Telegram bot running online.

This means my personal computer doesn’t need to remain turned on for the bot to work.

Git & GitHub

Git and GitHub are used for version control and deployment workflow.

The development cycle is essentially:

Code
↓
Test locally
↓
Git commit
↓
Git push
↓
Railway deployment

What Makes This Project Interesting?

There are already thousands of expense trackers.

So I don’t consider the main achievement to be “I built another expense tracker.”

The interesting part is the interaction model.

Traditional financial applications often require users to adapt to the application’s interface.

With this project, I tried to reverse that relationship.

Instead of forcing the user to learn the application, let the application understand the user.

The user doesn’t need to think:

“Which category should I select?”

They can simply say:

“I spent 20k on coffee.”

The AI translates that natural language into structured data.

The application then handles the deterministic parts:

  • Validation
  • Database operations
  • Calculations
  • Budget rules
  • Transaction history

And AI is used where interpretation is actually useful.

Current Features

The current version of the project can:

  • Record expenses
  • Understand natural-language expense messages
  • Automatically determine expense categories
  • Set a monthly budget
  • Prevent accidental budget replacement
  • Add additional budget
  • Show monthly financial summaries
  • Provide AI financial analysis
  • Generate daily financial reports
  • Support multiple Telegram users
  • Provide traditional commands
  • Provide a /help command
  • Store data in PostgreSQL
  • Run in Docker
  • Deploy to Railway
  • Use Supabase as managed database infrastructure
  • Integrate with DeepSeek for AI functionality

What Can be Improved

This project already satisfy most of my needs, yet there are still rooms to improve like sometimes it still cannot understand the meaning of the chat i sent even though its related to finance because of some spesific ‘ keyword ‘ missing which results to no answer from the AI, also we can still create a features related to deleting expenses, recurring expenses or even some kind of budget alarm when you spend too much within some period of time.

Final Thoughts

This project wasn’t originally created because I wanted to build the most sophisticated financial application possible.

It started with a much simpler goal:

I wanted to track my spending without feeling like I was doing administrative work.

So I chose an interaction model that I already use every day:

chatting.

If I can simply tell my bot:

“I had nasi padang for 15k.”

and it understands, records the transaction, updates my budget, and later gives me an overview of my financial behavior then the technology is actually solving the problem i started with.

And that’s probably the most interesting part of building this project.

Not the number of technologies involved.

Not the fact that it uses AI.

But the fact that a relatively complicated workflow can be reduced to something as simple as sending a message.

For those of you who wants to dig deeper about the application, do not hesitate to contact me via linkedin https://www.linkedin.com/in/febry-ramadhan-18205b1b4/ or instagram.

Application in Action

Press enter or click to view image in full size
asking how much i spent this month
Press enter or click to view image in full size
asking agent to analyze my expenses
Press enter or click to view image in full size
A command to know what the App can do and how it works
Press enter or click to view image in full size
Project Structure

And that’s just a glimpse of what the bot can do.

--

--

Febry Ramadhan
Febry Ramadhan

IG : frmad_ | Software Developer | Odoo Developer | Lifelong Learner