feat(server): Add messageThreadId handling in super groups for Telegram notifications#5409
feat(server): Add messageThreadId handling in super groups for Telegram notifications#5409AliArtukov wants to merge 5 commits into
Conversation
Add messageThreadId for sending alerts to specific topic of telegram group.
Updated messageThreadId to default to '0' and removed nullable annotations.
|
Hi guys. Changes
WhyTelegram supergroups support topic-based discussions, where messages can be posted into specific topics using the Backward Compatibility
Use CaseThis allows users to route notifications into dedicated topics inside Telegram supergroups (for example, separate topics for environments, services, or alert categories and our company is real case). |
| * Unique identifier for the target topic of the target super group | ||
| * 0 is an ID of general topic | ||
| */ | ||
| private String messageThreadId = "0"; |
There was a problem hiding this comment.
According to https://core.telegram.org/bots/api, this should be an Integer and not a String.
Moreover, I can't find anywhere stated that 0 is the default value. On the contrary, many implementations use 1 instead.
Finally, the parameter is optional, so not passing it at all if not provided is way safer than relying on some not really documented default value.
There was a problem hiding this comment.
I agree with you.
Currently changed attribute type to Integer and added message_thread_id to request param.
There was a problem hiding this comment.
The way you changed the things may break.
If no value is set it may either fail with NPE (if toString is called on it) or pass null as value (if valueOf is called with it).
Both the cases are wrong.
| /** | ||
| * Unique identifier for the target topic of the target super group | ||
| */ | ||
| private Integer messageThreadId; |
There was a problem hiding this comment.
Please mark it with @Nullable for consistency.
No description provided.