Telegram bots
Telegram's free Bot API turns a chat into a control panel and an alert channel. I use one bot to talk to my agent and a separate one for security alerts.
#What it is
Anyone can create a Telegram bot by messaging @BotFather (the official one with the blue tick) and sending /newbot. You get a bot token, and with that token a program can send and receive messages as the bot over a simple HTTPS API. No server needs to be reachable from the internet: the program reaches out to Telegram, not the other way round.
#Why I use it
It's the easiest way to get a message onto my phone from a box at home. I run two separate bots:
- one that is the front door to Hermes Agent, so I can chat with it from anywhere,
- one used only by Grafana for security alerts.
Keeping them separate means Hermes's token never lives in Grafana, and alerts keep working even when the agent is down or out of credit.
#How to find your chat ID
Alerting tools need to know where to send a message:
- Open your new bot, press Start, and send it "hi".
- Browse to
https://api.telegram.org/bot<YOUR_TOKEN>/getUpdates, replacing the whole<YOUR_TOKEN>including the brackets. - Find
"chat":{"id":123456789in the JSON. That number is your chat ID. Ifresultis empty, message the bot again and refresh.
#Trade-offs and alternatives
- The token is a password. Anyone holding it controls the bot. Never post a screenshot that shows it. If it leaks: BotFather,
/mybots, your bot, API Token, Revoke current token. - Restrict who the agent answers. A bot is public: anyone who finds its username can message it. Allow only known user IDs.
- Bot chats are not end-to-end encrypted. Messages pass through Telegram's servers. Fine for "honeypot touched from 192.168.1.66"; not for secrets.
- Alternatives: ntfy (self-hostable push notifications), Pushover, Signal via signal-cli, or plain email.