alertmanager
alertmanager copied to clipboard
Supported reply_to_message_id for Telegram topics.
This PR brings support to sending messages to specific Telegram topic, see https://telegram.org/blog/topics-in-groups-collectible-usernames
Topic is identified by id of the first message in this topic. In order to find out the id of the first message in a topic, in the Telegram desktop client, right-click on the first message in the topic, select "Copy Message Link". Get a link like: https://t.me/c/1234567890/1234/1235 The second part of the link is the id of the first message in the topic: 1234
Dear maintainers, I supported this for my project, but I think that it will be useful for Telegram users. If you have some comments, write me and I will definitely take them into account.
+1
Make some changes as the result of review. Replace reply_to_message_id with message_thread_id.
Hi @gotjosh, just checking in on the status of this PR. Looking forward to any updates, as it seems quite useful. Thanks!
@simonpasquier, @w0rm, @gotjosh Hello friends, could you please review this PR? Its will be very helpful for telegram users
hello friends it will be so good if you review this PR, i need send alerts to my telegram thread
Hi all, this very good function, @simonpasquier, @w0rm. @gotjosh please review it.
@nicknamenotknown I'm not a reviewer or maintainer in this repository
@nicknamenotknown I'm not a reviewer or maintainer in this repository
Sorry, it's my mistake.
@grobinson-grafana, why are your PRs getting reviewed and merged almost instantly, while this one has been languishing here for three months?
@simonpasquier hello! I see your PRs was merged last time. Can you help with this PR and communicate with repository maintainers, please? This is a very small feature but very helpful
+1
+1
This change is trivial and will not affect anything. Why not accept it?
Grafana already have this feature https://github.com/grafana/alerting/pull/143
This MR adds very useful feature, please accept it. :)
@VadimRezvov as a non Telegram user, what is the difference between reply_to_message_id
and message_thread_id
? I read the Telegram Bot API docs, and I'm still not sure I understand the difference.
We also have this PR here that uses the same configuration option message_thread_id
as the ThreadID
, instead of as ReplyTo
as done in this PR.
@VadimRezvov what is the difference between
reply_to_message_id
andmessage_thread_id
?We also have this PR here that uses the same configuration option
message_thread_id
as theThreadID
, instead of asReplyTo
as done in this PR.
@grobinson-grafana, as user @raphielscape said in the PR you linked, when answering the same question:
If you mean https://github.com/prometheus/alertmanager/pull/3560, this is not duplicate, message_thread_id inclusion is different compared to reply_to_message_id, even though the idea is the same (sending message to a certain topic), message_thread is the intended way to sending a message to a certain topic, reply_to_message, as the fields name says, are more targeted to replying to a certain message ID rather than sending messages.
So, though it serves the same purpose of sending a message to a telegram supergroup thread, it could also reply to a message on any chat, channel or group.
@VadimRezvov what is the difference between
reply_to_message_id
andmessage_thread_id
? We also have this PR here that uses the same configuration optionmessage_thread_id
as theThreadID
, instead of asReplyTo
as done in this PR.@grobinson-grafana, as user @raphielscape said in the PR you linked, when answering the same question:
If you mean #3560, this is not duplicate, message_thread_id inclusion is different compared to reply_to_message_id, even though the idea is the same (sending message to a certain topic), message_thread is the intended way to sending a message to a certain topic, reply_to_message, as the fields name says, are more targeted to replying to a certain message ID rather than sending messages.
So, though it serves the same purpose of sending a message to a telegram supergroup thread, it could also reply to a message on any chat, channel or group.
OK. It sounds like there might be a use case for both? I think #3638 can be reviewed once the author has signed their commits (https://github.com/prometheus/alertmanager/pull/3638#issuecomment-2008694648).
R.E this PR, the choice of message_thread_id
to set the reply_to_message_id
field seems incorrect, and it will also conflict with #3638. I think the author of this PR should update the PR to add a separate field just for reply_to_message_id
and then we can review that too.
To be short the message_thread_id replies to the first message of Telegram group ONLY in supergroups, and the reply_to_message_id (now it is reply_to_message https://core.telegram.org/bots/api#message) replies to the certain message id in the chat for any group type, so that its more multipurpose. So that, reply_to_message is more suitable for the purpose of sending message to certain Telegram topic.
OK! I think we need to coordinate the two PRs (this and #3638).
Have you also tested this change to make sure it works? The reason I ask is the version of the telebot package used in Alertmanager uses reply_to_message_id
not reply_to_message
:
if opt.ReplyTo != nil && opt.ReplyTo.ID != 0 {
params["reply_to_message_id"] = strconv.Itoa(opt.ReplyTo.ID)
}
You might also need to update the telebot package in go.mod
too if it doesn't work. I'll also set aside time next week to test it.
Ok, I will take this task, and will be back with results in nearest time.
To be short the message_thread_id replies to the first message of Telegram group ONLY in supergroups, and the reply_to_message_id (now it is reply_to_message https://core.telegram.org/bots/api#message) replies to the certain message id in the chat for any group type, so that its more multipurpose. So that, reply_to_message is more suitable for the purpose of sending message to certain Telegram topic.
Topics is only available for Supergroups, that's what the documentation conveys, you can't enable Topics in chat that are not supergroup to begin with, so message_thread_id is the proper way to send a message to a Topic as the intended MR is for replying to a Topic rather than message, and that message thread starter ID might be changed if the chat has gone beyond 1 million, so this might not be sustainable to use reply to message as the message it replied might be lost if you have a lot of messages on the chat
Hi! 👋 https://github.com/prometheus/alertmanager/pull/3638 has been merged to main. I would appreciate it if you could test it and make sure it works as I cannot seem to create a Telegram supergroup or topics (perhaps I just don't know how to do it?).
Привет! 👋 #3638 был объединен с основным. Я был бы признателен, если бы вы могли протестировать его и убедиться, что он работает, так как я не могу создать супергруппу или темы Telegram (возможно, я просто не знаю, как это сделать?).
Hi, grobinson-grafana! I'm new to GitHub, can you tell me if I can download the latest version of AlertManager and test this functionality? I'd like to test the ability to send a message to a supergroup with message_thread_id.