OpenSRE’s Telegram integration delivers investigation findings to any chat your bot has been added to — useful for mobile-first on-call rotations and personal alerting.Documentation Index
Fetch the complete documentation index at: https://opensre.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
Unlike Slack and Discord, Telegram is not included in the interactive
opensre onboard wizard today. Configure it via environment variables or by editing ~/.config/opensre/integrations.json directly. Tracked at #1481.Prerequisites
- A Telegram account.
- The Telegram mobile or desktop app, signed in.
- The chat (group, channel, or direct message) where you want to receive findings.
Step 1: Create a bot with BotFather
BotFather is Telegram’s official bot for creating other bots.- Open Telegram and search for
@BotFather. Open the chat and tap Start. - Send
/newbot. - When prompted, send a display name for your bot (e.g.
OpenSRE Alerts). - Send a username that ends in
bot(e.g.opensre_alerts_bot). It must be globally unique. - BotFather replies with an HTTP API token of the form
<numeric-id>:<token-secret>. Copy it — it is your bot token. Treat it like a password. Anyone holding it can send messages as your bot.
Step 2: Add the bot to a chat
The bot can deliver to three kinds of destinations. Pick the one that fits your team:- Group chat
- Channel
- Direct message
- Open the group where you want findings to land.
- Tap the group name → Add members → search for your bot’s username → Add.
- By default, bots in groups only see messages addressed to them, which is fine for delivery-only.
Step 3: Find your chat_id
The chat ID identifies where the bot should post.
-
Send any message in the destination chat — for a channel, post anything; for a DM, send
/startto your bot. -
In a browser, open:
(replace
<YOUR_BOT_TOKEN>with the token from Step 1) -
In the JSON response, look for a
chat.idfield. The value depends on the chat type:Copy the entire value, including the leading minus sign for groups and channels.Chat type Format Example Direct message with a user Positive integer 123456789Group Negative integer -987654321Supergroup or channel Negative integer starting with -100-1001234567890
If
getUpdates returns an empty array, post a fresh message in the chat and reload — Telegram only buffers recent updates.Step 4: Configure the integration
Set two environment variables in your.env file:
| Variable | Description |
|---|---|
TELEGRAM_BOT_TOKEN | Bot HTTP API token from BotFather. Required. |
TELEGRAM_DEFAULT_CHAT_ID | Default delivery destination. Required for delivery to work. |
Step 5: Verify
getMe endpoint. On success it reports the bot’s @username. On failure it reports the Telegram API error message verbatim.
You can also trigger a real investigation against a bundled fixture:
Troubleshooting
opensre integrations verify telegram only calls Telegram’s getMe endpoint, so it surfaces token-validity errors but cannot detect chat-routing problems. Delivery-time errors only show up when an investigation actually posts.
Errors from opensre integrations verify telegram
Missing bot_token
TELEGRAM_BOT_TOKEN is empty. Re-check .env and restart any long-running OpenSRE process so it re-reads the file.
Telegram API check failed: 401 Client Error: Unauthorized for url: …
The bot token is invalid or has been revoked. Generate a new one in BotFather (/mybots → your bot → API Token → Revoke current token) and update .env.
Errors that only surface during delivery
These are Telegram API responses that come back when OpenSRE actually tries to post a finding.verify only calls getMe, so it cannot catch them. They appear in OpenSRE logs as [telegram] post message failed: <description> with the Telegram description copied verbatim.
description: chat not found
The bot is not in the chat, or TELEGRAM_DEFAULT_CHAT_ID is wrong. Re-add the bot and re-fetch chat_id from getUpdates.
description: bot was kicked from the supergroup … (or similar)
Re-add the bot. For channels, the bot must be an administrator with Post Messages permission.
Findings never arrive, but verify passes
getMe only confirms the token is valid; it does not test delivery. Send a fresh message in the destination chat and re-fetch chat_id from getUpdates — your chat_id may have changed (for example, if a group was upgraded to a supergroup, the ID is renamed with a -100 prefix).
Tracer