Ops bot for the Txio team.
- Listens for GitHub webhook events (issues, pull requests, CI runs, deployments) and posts a formatted notification into the Telegram group. Each event type can optionally be routed to its own forum topic, and pull requests can be routed to a private DM instead of the group.
- Welcomes new members when they join the group.
- Create the bot: message @BotFather on
Telegram, run
/newbot, and copy the token intoTELEGRAM_BOT_TOKEN. - Add the bot to the group as a regular member (no admin needed).
- Get the group's chat id: send any message in the group, then check
https://api.telegram.org/bot<TOKEN>/getUpdatesfor"chat":{"id": ...}(group ids are negative, supergroup/forum ids look like-100xxxxxxxxxx). SetTELEGRAM_CHAT_ID. - Deploy it somewhere with a public URL (see Docker/Render below) and
set
PUBLIC_URLto that URL — it's used to register the Telegram webhook that powers the new-member welcome message. - Configure the GitHub webhook: in the repo's (or org's) Settings >
Webhooks, add a webhook pointing at
<PUBLIC_URL>/webhooks/github, content typeapplication/json(GitHub defaults toapplication/x-www-form-urlencoded— you must change this), and a secret matchingGITHUB_WEBHOOK_SECRET. Subscribe to: Issues, Pull requests, Workflow runs, Deployment statuses. - Copy
.env.exampleto.envand fill in the values above.
The group needs Topics enabled (Group settings > Topics) for thread routing to work.
- Topic ids: open the topic, send a message, then check
getUpdatesfor"message_thread_id"in that update. SetTOPIC_THREAD_ISSUES/TOPIC_THREAD_CI/TOPIC_THREAD_DEPLOYS. Unset ones fall back to the group's General topic. - PR private DM: DM the bot directly, send it any message, then check
getUpdatesfor that message's"chat":{"id": ...}(your personal chat id, a positive number). SetPULL_REQUEST_CHAT_ID— pull request notifications go there instead of the group.
npm install
npm run dev # local development, ts via tsx
npm run build && npm start # production
docker build -t txio-telegram-bot .
docker run --env-file .env -p 3000:3000 txio-telegram-bot
render.yaml is included — Render dashboard > New > Blueprint, connect
this repo, and set the secret env vars (TELEGRAM_BOT_TOKEN,
TELEGRAM_CHAT_ID, GITHUB_WEBHOOK_SECRET, PUBLIC_URL, and any of the
optional routing vars) in the dashboard.
See CONTRIBUTING.md for bug reports, enhancement suggestions, and the PR process. Please also read our Code of Conduct.
MIT — see LICENSE.