← Nazaj na blog

Osebni finančni dnevnik

Features

  • Expense/income logging by text in Telegram
  • Multi-user support — multiple people can log expenses into the same database
  • Spreadsheet overview of expense/income flows by category
  • Spreadsheet overview of expense/income flows by month
  • Custom dynamic categories — 16 expense, 10 income
  • Monthly report in chat
  • Monthly recurring expenses can be automated

Planned improvements

  • Your year in finance
  • Additional weekly/monthly insights
  • Weekly report

Introduction

Expense tracking these days is quite complex because of:

  • Different income sources
  • Different payment methods
  • A single person often has multiple credit/debit cards in addition to cash

Expense/income tracking apps exist but they have downsides:

  • Cannot connect to all services
  • Tracking cash payments is still manual
  • Do we really need another app on our phone?

For Millennials, Gen Z, and younger generations, text messaging is a very natural input to smart devices. With that in mind I designed an application that lives completely free in your Google account (if you're willing to pay the data toll to our friendly neighbourhood tech giant).

Final result

At the end we will have a Telegram chat where we can input expenses and earnings. All expenses go into Google Sheets where they are automatically sorted monthly by category.

Telegram chat example
Telegram chat example
May expense report
May expense report

Architecture overview

Architecture overview
Architecture

The frontend of our app is Telegram — a well-known messaging application similar to Viber and WhatsApp. Telegram has great "Bot support" and it is easy to configure a Bot to send data to a webhook.

The webhook is a Google App Script Web App. App Script enables JavaScript code that communicates with Google documents. It intercepts Telegram messages, validates the format, and appends the data to a spreadsheet. The spreadsheet then further organises data by months and categories.

Deployment guide

Google Sheets

Just open this document and copy it to your Google account:

Google Sheets Template

Google Sheets Template
Copy Google Sheet template

Telegram Bot

Set up Telegram on your phone number, then:

  1. Open Telegram on your PC: Telegram Web
  2. Open chat with @BotFather:
    BotFather chat
    BotFather Telegram Chat
  3. Type /newbot and follow instructions:
    Create new bot
    Create new bot in Telegram
  4. The API key will be shown — you'll need it. Leave the chat open and proceed.

AppScript

I developed an AppScript that handles communication between Telegram and Google Sheets. Full source code: GitHub repository

  1. Go to Google App Script logged into your account.
  2. Create a new Project.
  3. Rename the project:
    Rename project
    AppScript — rename project
  4. Copy the code from GitHub into Code.gs.
  5. Populate the initial variables:
    • Telegram API key
    • ssID (Spreadsheet ID from the URL):
      Spreadsheet ID
      Google Spreadsheet ID
    • AdminID (your Telegram ID — message /start to @userinfobot)
    • webAppUrl — proceed to the next step first
  6. Save the project.
  7. Deploy → New Deployment:
    New deployment
    Deploy — New deployment
  8. Select Web App type and configure:
    Deployment type
    Deploy — Select type
  9. Authorize the app:
    Authorize
    Deploy — Authorize app
  10. Copy the Web App URL and use it in step 5:
    Web App URL
    Google Web App URL

    For updating: How to edit versioned deployment

  11. Run setWebhook function:
    Run setWebhook
    Run setup webhook
  12. Run sheetPermissions to authorize sheet access.
  13. Set up a daily trigger for recurring expenses.

Post deployment

Open Telegram, write HELP to your bot:

Help output
Help output

All inputs can later be edited/removed directly in the spreadsheet.

Configuration

Open the Categories sheet to configure your custom categories (16 expense + 10 income):

Configure categories
Configure categories