Skip to content

aknarts/fiobot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fio Bot

A CLI bot for Fio Banka that automates transaction routing. It fetches account movements, applies configurable rules to compute domestic transfers, posts them via the Fio API, and sends email notifications.

Features

  • Rule-based transaction routing — Define rules per account with fixed amounts or percentages of the closing balance, executed in sequence
  • Dry-run mode — Preview what transactions would be posted without actually sending them
  • Email notifications — Get notified when transactions are posted, with per-account or default email configuration
  • Transaction audit log — Every posted transaction is recorded with timestamps, amounts, and API responses
  • Multi-account — Manage multiple Fio accounts with separate tokens and rules
  • Interactive setup TUI — Full-screen terminal interface for managing accounts, rules, and emails with keyboard and mouse support

Requirements

Quick Start

# Build
cargo build --release

# Set up the database (migrations run automatically on first start)
export DATABASE_URL=database.sql

# Or use the interactive setup wizard
cargo run -- setup

# Add an account (CLI)
cargo run -- account add -n "My Account" -b 1234567890 -t "your-fio-api-token"

# Add a rule: send 500 CZK to account 9876543210 at bank 0800
cargo run -- rule add -a 1234567890 -m 500 -t "9876543210" -u "0800"

# Add a percentage rule: send 10% of balance
cargo run -- rule add -a 1234567890 -m 10 -t "9876543210" -u "0800" -p

# Preview what would happen
cargo run -- --dry-run

# Run for real
cargo run

Usage

fiobot [OPTIONS] [COMMAND]

Commands:
  setup   Interactive setup interface (TUI)
  account  Manage bank accounts
  rule     Manage transaction rules
  email    Manage email notifications

Options:
  --dry-run  Show what transactions would be posted without actually posting
  -h, --help Print help

When run without a subcommand, the bot fetches new movements for all accounts, computes transactions from active rules, and posts them.

Interactive Setup (Recommended)

cargo run -- setup

Launches a full-screen TUI for managing your bot configuration. Features:

  • Dashboard — Overview of all accounts, rules (grouped by account), and emails
  • Account wizard — Paste an API token and account details are fetched automatically from the Fio API
  • Account selectors — Rules and emails reference accounts via a picker (no manual number typing)
  • Mouse support — Click to select rows in any list
  • Keyboard shortcutsa add, e edit, d delete, t toggle, f filter, Esc back, Ctrl+C quit

Account Management

cargo run -- account add -n "Name" -b 12345 -t "token"
cargo run -- account add -n "Name" -b 12345 -t "token" -r  # read-only token
cargo run -- account remove -n "Name"
cargo run -- account list
cargo run -- account list -t  # show full tokens

Rule Management

cargo run -- rule add -a 12345 -m 100 -t "target_acc" -u "0800"       # fixed 100
cargo run -- rule add -a 12345 -m 50 -t "target_acc" -u "0800" -p     # 50% of balance
cargo run -- rule edit -i 1 -m 200                                     # change amount
cargo run -- rule toggle -i 1                                          # activate/deactivate
cargo run -- rule remove -i 1
cargo run -- rule list
cargo run -- rule list -a 12345                                        # filter by account

Rules are applied in sequence order. Percentage rules compute against the running balance (after previous rules have been applied), not the original closing balance.

Email Notifications

cargo run -- email add -m "user@example.com" -d          # default for all accounts
cargo run -- email add -m "user@example.com" -a 12345    # account-specific
cargo run -- email remove -a 12345
cargo run -- email list

Requires the FROM_EMAIL environment variable to be set. If unset, email notifications are silently skipped.

Environment Variables

Variable Required Purpose
DATABASE_URL Yes Path to SQLite database file
FROM_EMAIL No Sender address for email notifications (skipped if unset)

Development

cargo build          # debug build
cargo test           # run 20 tests
cargo build --release

# Database migrations
diesel migration run
diesel migration generate <name>

License

MIT

About

A bot for Fio Bank

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages