Chitie stands for chi tiết
& chi tiêu
in Vietnamese it means detail on your expenses.
This is a bot for the Telegram messaging app using their bot platform. It helps you to keep track of your expenses, supporting your financial planning. It is simple, like sending a message to a friend on Telegram. No extra application is installed, but it can work on multiple platforms, desktops, and mobiles (like Telegram 😊)
Your data is secured on your server, which is very flexible as you can write your SQL to build reports.
To host this bot on your own, you need a few things.
- Server to run the bot on 1
- A domain name with
HTTPS
enabled 2 - A bot token, which you get from registering a new bot to the @BotFather
On your server:
- Python3
- PostgreSQL
- Nginx
Link your domain to the bot
Once you have chosen a bot, send the /setdomain command to @Botfather to link your website's domain to the bot. Then configure your widget below and embed the code on your website.
Set following environment variable on the running application session, or create an .env
file in the root directory of the application
Property | Example | Description |
---|---|---|
DB_URL | postgresql://user:password@localhost:5432/chitie | PostgreSQL connection url |
SECRET_KEY | complex-random-string | A secret key that will be used for securely signing the session cookie and can be used for any other security related needs by extensions or your application |
SERVER_NAME | chitie.yourdomain | Your web domain |
TELEGRAM_SECRET | telegram-secret-string | The secret string gotten from @BotFather when create new bot |
TELEGRAM_WEBHOOK_SECRET | some-secret-string | To generate a secure url for webhook endpoint |
Install dependencies
pip install -e '.[production]'
Init database schema
alembic upgrade head
uwsgi --enable-threads --socket 0.0.0.0:5000 --protocol http -w wsgi:webserver
Send a message in the configured group with the format.
<expense subject: string> <amount: float><transaction_type:enum(‘’, ‘c’)>
There are two types of transactions – debit & credit. In a logging message, if the transaction type is empty, the default value is debit, and if the amount pattern is followed with a c letter, the transaction type is credit.
Example:
Debit expense:
Credit expense:
Command | Description |
---|---|
/category | List all categories |
/review <month-year> |
Summary all expenses in the given time range. The default time range is the current month if not given |
Init the expense chat group
Logging your expenses by sending a message
Review your expense in month
Footnotes
-
I use Digital Ocean with $6/ ↩
-
I use free SSL of Cloudflare ↩