oncall icon indicating copy to clipboard operation
oncall copied to clipboard

Feat 549 - add telegram permalink to alert groups http response

Open joeyorlando opened this issue 3 years ago • 2 comments

This PR closes #549.

It does the following:

  • renames/refactors the AlertGroup model's permalink property to slack_permalink
  • adds a telegram key to the permalinks object in the alert group's public API HTTP response object

Tested locally Screen Shot 2022-09-22 at 18 09 46

joeyorlando avatar Sep 22 '22 12:09 joeyorlando

A question I had was whether it or it makes sense to return just one, or multiple telegram permalinks? As I understand an AlertGroup has a one-to-many relationship with a TelegramMessage.

joeyorlando avatar Sep 22 '22 12:09 joeyorlando

A question I had was whether it or it makes sense to return just one, or multiple telegram permalinks? As I understand an AlertGroup has a one-to-many relationship with a TelegramMessage.

I would say we only want to show the main alert group message in the channel (not DMs). The query would be something like this:

alert_group.telegram_messages.filter(Q(chat_id__startswith="-") & Q(message_type=TelegramMessage.ALERT_GROUP_MESSAGE)).first()

If chat_id starts with "-" it means it's a channel message and not a DM.

vstpme avatar Sep 22 '22 12:09 vstpme