Skip to content

feat(telegram): support forum topic thread ID (#565) - #568

Merged
Mzack9999 merged 2 commits into
projectdiscovery:mainfrom
TassioSales:feat/telegram-topic-thread-id
Oct 27, 2026
Merged

Mzack9999 merged 2 commits into
projectdiscovery:mainfrom
TassioSales:feat/telegram-topic-thread-id

Conversation

@TassioSales

@TassioSales TassioSales commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #565

Summary of Changes

Previously, notify could only send messages to the whole Telegram chat or group without a dedicated thread configuration field. In Telegram groups with forum topics enabled, notifications need to be targeted to specific topics.

This PR adds dedicated thread ID support:

  1. telegram_thread_id Configuration Option: Added TelegramThreadID to telegram.Options mapping to telegram_thread_id in YAML.
  2. Channel Format: When TelegramThreadID is provided (and not already formatted with a colon), telegramURL formats the channel as chatID:threadID, which shoutrrr automatically extracts and dispatches as message_thread_id to the Telegram Bot API.
  3. Documentation: Updated README.md to document telegram_thread_id.
  4. Unit Tests: Added test cases in pkg/providers/telegram/telegram_test.go covering:
    • Formatting channel with chatID:threadID when thread ID is configured.
    • Preserving existing colon in chat ID when already specified.

Signed-off-by: TassioSales tassiolucian.ljs@gmail.com

Summary by CodeRabbit

  • New Features
    • Telegram notifications can target a specific forum topic or thread using an optional thread ID. If the chat ID already includes a colon, it is used unchanged.
    • Gotify notifications support newer token formats, while retaining support for legacy tokens. Messages can include an optional title.
  • Documentation
    • The Telegram configuration example now shows the optional thread ID setting.

Add telegram_thread_id option to allow addressing specific forum topics and message threads in Telegram groups.

Signed-off-by: TassioSales <tassiolucian.ljs@gmail.com>
@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Caution

Review failed

The pull request is closed.

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: cdb1b8fb-8ae2-4bfc-ab84-01059d6c27c2
Commits

Reviewing files that changed from the base of the PR and between c30caef and b37f073.

Files selected for processing: 3
  • README.md
  • pkg/providers/telegram/telegram.go
  • pkg/providers/telegram/telegram_test.go

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.

Walkthrough

The Telegram provider adds an optional telegram_thread_id setting. When set, it appends the thread ID to the chat ID in the generated URL if the chat ID contains no colon. Tests cover both cases.

Changes

Telegram topic routing

Layer / File(s) Summary
Configure and format Telegram thread IDs
pkg/providers/telegram/telegram.go, pkg/providers/telegram/telegram_test.go, README.md
Options adds TelegramThreadID. URL construction appends it to the chat ID only when the thread ID is set and the chat ID contains no colon. Tests cover both URL cases, and the README example includes the optional setting.

Priority: Not assessed

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Possibly related PRs

Suggested reviewers: mzack9999

Merge Risk: Moderate · up to 6a798

Gotify messages may appear sent without delivery, and redirects can expose delivery tokens. Explicitly configured integration tests can also be skipped. Resolve these paths before merging.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: adding support for Telegram forum topic thread IDs.
Linked Issues check Passed Issue #565 requires an optional thread ID that sends notifications to a configured Telegram topic. Options.TelegramThreadID maps to telegram_thread_id. When the value is non-empty and `TelegramCha…
Out of Scope Changes check Passed The changed files support issue #565. telegram.go adds the configuration field and URL formatting. telegram_test.go adds focused unit tests. README.md documents the new option. No unrelated chan…
Full details: Linked Issues check

Explanation

Issue #565 requires an optional thread ID that sends notifications to a configured Telegram topic. Options.TelegramThreadID maps to telegram_thread_id. When the value is non-empty and TelegramChatID has no colon, telegramURL creates chatID:threadID, which shoutrrr uses for Telegram topic delivery. The tests cover thread formatting and existing colon preservation. README.md documents the option.

Full details: Out of Scope Changes check

Explanation

The changed files support issue #565. telegram.go adds the configuration field and URL formatting. telegram_test.go adds focused unit tests. README.md documents the new option. No unrelated change is shown in the supplied evidence.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit taps a topic key,
A thread ID joins the chat,
The URL carries both along,
No colon means it’s added,
Then hops away, content.

Comment @coderabbitai help to get the list of available commands.

@Mzack9999
Mzack9999 merged commit d177012 into projectdiscovery:main Oct 27, 2026
3 of 4 checks passed
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.

Send notify messages to a Telegram topic

2 participants