Skip to content

feat(telegram): add support for topics in groups - #1536

Open
Matin-B wants to merge 1 commit into
nttgin:mainfrom
Matin-B:feature/telegram-topics
Open

feat(telegram): add support for topics in groups#1536
Matin-B wants to merge 1 commit into
nttgin:mainfrom
Matin-B:feature/telegram-topics

Conversation

@Matin-B

@Matin-B Matin-B commented Jun 4, 2026

Copy link
Copy Markdown

Currently, the Telegram report module only supports sending alerts to standard chats, channels or groups. With Telegram's "Topics" feature for groups, it makes much more sense to route different alerts into specific topic threads rather than scattering them across multiple chats.

This approach is highly practical for maintaining a single, unified monitoring group. For example, you can have one central NOC group where BGPalerter, Uptime Kuma, and other infrastructure tools each get their own dedicated topic.

This PR adds an optional messageThreadIds parameter to the reportTelegram configuration to support this workflow.

Changes made:

  • Added the messageThreadIds block in config.yml.example (structurally mirroring chatIds).
  • Updated reportTelegram.js to parse this new configuration and inject the message_thread_id key into the HTTP payload sent to the Telegram API.
  • Added documentation for the new parameters in docs/reports.md.

Backwards Compatibility:

I ensured this does not break existing configurations. The script strictly parses the ID as an integer. If messageThreadIds is omitted entirely, undefined, or explicitly set to 0, the message_thread_id key is completely excluded from the payload object. It will safely fall back to standard group chat routing without throwing API errors.

I compiled and tested this locally and the alerts successfully route into the designated topics. Let me know if any adjustments are needed.

This commit introduces the optional 'messageThreadIds' configuration parameter to the reportTelegram module. It allows users to route specific alert channels (e.g., 'noc', 'default') to specific topic threads within Telegram Forum Supergroups by injecting the 'message_thread_id' key into the HTTP POST payload. Strict non-zero integer validation is included to ensure absolute backwards compatibility with standard groups.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant