-
Notifications
You must be signed in to change notification settings - Fork 152
feat: Add support for Telegram message threads #501
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
feat: Add support for Telegram message threads #501
Conversation
This commit introduces the ability to send notifications to specific message threads (topics) within Telegram groups. The following changes were made: - Added a new optional `telegram_thread_id` field to the Telegram provider configuration in `pkg/providers/telegram/telegram.go`. - Modified the `Send` function in the Telegram provider to append the `telegram_thread_id` to the `telegram_chat_id` in the Shoutrrr URL if provided. The format used is `chat_id:thread_id`. - Updated `README.md` to include documentation for the new `telegram_thread_id` field and provided a link to the Shoutrrr documentation for instructions on obtaining the `message_thread_id`. - Added unit tests in `pkg/providers/telegram/telegram_test.go` to verify the correct construction of the Telegram URL with and without the `telegram_thread_id`. This involved refactoring `pkg/providers/telegram/telegram.go` to allow mocking of the `shoutrrr.Send` function for testing purposes. This feature allows you to direct notifications to specific topics in your Telegram groups, providing more granular control over where notifications appear.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThe updates introduce support for an optional Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant TelegramProvider
participant shoutrrrSendFunc
User->>TelegramProvider: Send(message, options)
alt TelegramThreadID is set
TelegramProvider->>TelegramProvider: Combine ChatID and ThreadID
else TelegramThreadID is empty
TelegramProvider->>TelegramProvider: Use ChatID only
end
TelegramProvider->>shoutrrrSendFunc: Send(serviceURL, message)
Poem
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
dwisiswant0
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
integration test fails & conflicts
This commit introduces the ability to send notifications to specific message threads (topics) within Telegram groups.
The following changes were made:
telegram_thread_idfield to the Telegram provider configuration inpkg/providers/telegram/telegram.go.Sendfunction in the Telegram provider to append thetelegram_thread_idto thetelegram_chat_idin the Shoutrrr URL if provided. The format used ischat_id:thread_id.README.mdto include documentation for the newtelegram_thread_idfield and provided a link to the Shoutrrr documentation for instructions on obtaining themessage_thread_id.pkg/providers/telegram/telegram_test.goto verify the correct construction of the Telegram URL with and without thetelegram_thread_id. This involved refactoringpkg/providers/telegram/telegram.goto allow mocking of theshoutrrr.Sendfunction for testing purposes.This feature allows you to direct notifications to specific topics in your Telegram groups, providing more granular control over where notifications appear.
Summary by CodeRabbit