Skip to content

[telemetry] Telegram bot: profit alerts + error notifications + daily summary #21

@obchain

Description

@obchain

Context

For a bot running headless on a VPS, push notifications are how you know it's alive. Telegram is free, supports markdown, mobile, web, and desktop clients — and the Bot API is dead-simple HTTP.

Scope

  • charon-telemetry/src/alerts.rs with a TelegramNotifier
  • Config: bot_token, chat_id (via env vars, not in TOML)
  • Events:
    • Profit alert — every successful liquidation (amount + tx hash link)
    • Error notification — panics, RPC disconnects, > N consecutive tx failures
    • Daily summary — once per UTC day: total profit, liquidation count, uptime %
  • Rate-limiting (max 20 msgs / minute to avoid Telegram throttling)
  • Graceful fallback: if Telegram API is down, log locally and keep running

Acceptance criteria

  • Sends a startup message when the bot launches
  • Successful liquidation triggers a formatted alert with tx link
  • Rate limiter drops/queues excess messages with a WARN log
  • Missing TELEGRAM_* env vars disables the notifier without crashing
  • Daily summary fires at 00:00 UTC

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    layer:devopsCI / deploy / infra / telemetrypriority:p2-polishNice-to-have / polishstatus:readyScoped and ready to pick uptype:featureNew capability or deliverable

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions