diff --git a/server/notification-providers/slack.js b/server/notification-providers/slack.js index 98ed1a90..77264205 100644 --- a/server/notification-providers/slack.js +++ b/server/notification-providers/slack.js @@ -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); diff --git a/src/components/notifications/Slack.vue b/src/components/notifications/Slack.vue index dead709c..dc07bf37 100644 --- a/src/components/notifications/Slack.vue +++ b/src/components/notifications/Slack.vue @@ -9,6 +9,12 @@ + +