mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-08-09 12:21:22 +08:00
[slack] allow the user to choose the message format to send (#5167)
Co-authored-by: Louis Lam <louislam@users.noreply.github.com> Co-authored-by: Frank Elsinga <frank@elsinga.de>
This commit is contained in:
@@ -139,17 +139,22 @@ class Slack extends NotificationProvider {
|
||||
|
||||
const title = "Uptime Kuma Alert";
|
||||
let data = {
|
||||
"text": `${title}\n${msg}`,
|
||||
"channel": notification.slackchannel,
|
||||
"username": notification.slackusername,
|
||||
"icon_emoji": notification.slackiconemo,
|
||||
"attachments": [
|
||||
"attachments": [],
|
||||
};
|
||||
|
||||
if (notification.slackrichmessage) {
|
||||
data.attachments.push(
|
||||
{
|
||||
"color": (heartbeatJSON["status"] === UP) ? "#2eb886" : "#e01e5a",
|
||||
"blocks": Slack.buildBlocks(baseURL, monitorJSON, heartbeatJSON, title, msg),
|
||||
}
|
||||
]
|
||||
};
|
||||
);
|
||||
} else {
|
||||
data.text = `${title}\n${msg}`;
|
||||
}
|
||||
|
||||
if (notification.slackbutton) {
|
||||
await Slack.deprecateURL(notification.slackbutton);
|
||||
|
Reference in New Issue
Block a user