Go utility that polls multiple provider APIs, stores daily spending history per service, and sends balance summaries to Telegram users.
- Service definitions driven by a YAML configuration file (HTTP request data and JSON fields to extract).
- Daily scheduler powered by go-quartz with timezone support.
- History writer that keeps the last N days of spend per provider in JSON files (no database required).
- Telegram notifications using telego, with configurable chat recipients.
- Structured logging via iSlogger.
Create a configuration file (for example config.yaml) based on config.example.yaml and provide:
- Global settings:
days_for_avg,minimum_days_left,history_dir. scheduletime inHH:MM(24h) and optionaltimezone.- Telegram bot token and the list of chat IDs to notify.
- Service entries describing HTTP request details and the JSON path to the balance (
response.balance_path).
Environment variables can be referenced inside headers, query params, URLs, and request bodies (e.g. ${NOWPAYMENTS_API_KEY}). The checker automatically loads values from a local .env file if present.
Each history file is written inside history_dir. The checker clips data to days_for_avg entries and calculates average spend and days of balance remaining. When the remaining days number drops below minimum_days_left, the Telegram message ends with !!!.
Build or run directly:
-
Copy
.env.exampleto.envand fill in provider secrets (or export the variables manually). -
Start the checker:
go run ./cmd/balance-checker -config config.yaml
The process installs a daily job according to the configured time and keeps running until interrupted (Ctrl+C, SIGTERM, etc.).
To execute a single check immediately and exit, pass -run-once:
go run ./cmd/balance-checker -config config.yaml -run-onceIf .env is missing the app still starts; any undefined placeholders expand to empty strings, so double-check that all required values are provided.
Logs are stored under logs/ by default. History files are created under the configured directory (default data/).
For each provider, supply:
request.method,request.url, headers, query parameters, optional JSON body, and optionaltimeout_seconds.response.balance_path– a gjson path pointing to the numeric balance in the API response.- Optional
response.currency_fieldif the API returns currency code, and/orcurrency_symbolto enforce a prefix like$in reports. - Set
response.multiple: truewhen the balance path yields an array. Each value is tracked independently, with currencies taken fromcurrency_field(arrays are supported) orcurrency_symbolas fallback.
Adjust the example configuration to match real API responses from: presets_services Ensure the Telegram bot token and chat IDs are valid before running the checker.