File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed
internal/platform/repositories/alert Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -22,14 +22,18 @@ func (r *Repository) CreateTelegramMessage(alert models.Alert) error {
2222 continue
2323 }
2424
25- params := url.Values {}
26- params .Add ("chat_id" , team [0 ].Chat )
27- params .Add ("parse_mode" , "markdownv2" )
28- if team [0 ].Topic != "" {
29- params .Add ("message_thread_id" , team [0 ].Topic )
25+ // Create a list of URLs for every targets in the team.
26+ // For example, a team needs to send a message to 2 chats, so we create 2 URLs.
27+ for _ , t := range team {
28+ params := url.Values {}
29+ params .Add ("chat_id" , t .Chat )
30+ params .Add ("parse_mode" , "markdownv2" )
31+ if t .Topic != "" {
32+ params .Add ("message_thread_id" , t .Topic )
33+ }
34+ url := r .config .Notifier .Telegram .Host + r .config .Notifier .Telegram .Token + "/sendMessage?" + params .Encode ()
35+ urls = append (urls , url )
3036 }
31- url := r .config .Notifier .Telegram .Host + r .config .Notifier .Telegram .Token + "/sendMessage?" + params .Encode ()
32- urls = append (urls , url )
3337 }
3438
3539 payload := formatTelegramMessage (alert )
You can’t perform that action at this time.
0 commit comments