Skip to content

Fyfar/budgetbot

Repository files navigation

BudgetBot

Telegram bot that tracks Monobank balance changes and sends daily budget reports.

Links

Deploy

1. Prepare config files

Create ./data/monobank.json:

{
  "tokenList": ["your_monobank_token"]
}

Create ./data/telegram.json:

{
  "login": "your_bot_username",
  "token": "your_bot_token"
}

2. Configure secrets

cp .env.example .env
# Edit .env: set TUNNEL_TOKEN, MONOBANK_WEBHOOK_PUBLIC_URL, MONOBANK_WEBHOOK_SECRET

MONOBANK_WEBHOOK_SECRET should be a long random string (e.g. openssl rand -hex 32).

3. Set up Cloudflare Tunnel

In Cloudflare Zero Trust → Networks → Tunnels:

  1. Create a named tunnel, copy the tokenTUNNEL_TOKEN in .env
  2. Add public hostname: budgetbot.yourdomain.com → service type HTTP, URL bot:7070
  3. Set MONOBANK_WEBHOOK_PUBLIC_URL=https://budgetbot.yourdomain.com in .env

4. Start

docker compose up -d --build

Verify:

# Health check
docker compose exec bot curl -fsS http://localhost:7070/health

# Webhook handshake (should return 200)
curl https://budgetbot.yourdomain.com/personal/balance/webhook/<your-secret>

# Logs
docker compose logs -f

The app registers the webhook with Monobank automatically on startup. A 6-hourly cron re-registers it if Monobank disables it after failed deliveries.

Development

# Java 21 required
mvn clean test          # run tests
mvn package -DskipTests # build jar → target/budgetbot-1.0.0.jar

About

Telegram bot that tracks Monobank balance changes and calculates daily budget status. Micronaut 4 / Java 21, webhook-driven, deployed via Docker + Cloudflare Tunnel.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors