add author icon

This commit is contained in:
psy 2022-01-16 11:29:05 +01:00
parent a2a6a9892e
commit 60bb897613
No known key found for this signature in database
GPG key ID: DFF5B17AC3A8ECF5

View file

@ -21,6 +21,24 @@ icons = {
'resolved': ':white_check_mark:' 'resolved': ':white_check_mark:'
} }
'''
Example message:
{
"text": "Example message",
"attachments": [
{
"title": "Rocket.Chat",
"title_link": "https://rocket.chat",
"text": "Rocket.Chat, the best open source chat",
"image_url": "/images/integration-attachment-example.png",
"color": "#764FA5"
}
]
}
'''
''' '''
Example attachment: Example attachment:
@ -147,6 +165,7 @@ def send_alert_message(channel, alert):
"message_link": alert.get('generatorURL', '#'), # link for timestamp, mandatory to display timestamp "message_link": alert.get('generatorURL', '#'), # link for timestamp, mandatory to display timestamp
"collapsed": True, # collapse details by default "collapsed": True, # collapse details by default
"author_name": alert['labels'].get('instance', 'unknown'), "author_name": alert['labels'].get('instance', 'unknown'),
"author_icon": "https://rocket.cccv.de/emoji-custom/molli.png",
"title": alert['annotations']['title'], "title": alert['annotations']['title'],
"fields": [{"short": True, "title": key, "value": value} for key, value in alert['labels'].items() if "fields": [{"short": True, "title": key, "value": value} for key, value in alert['labels'].items() if
key not in label_ignore_fields] key not in label_ignore_fields]