diff --git a/server/notification-providers/slack.js b/server/notification-providers/slack.js index da89f0f7a..f4a72b03e 100644 --- a/server/notification-providers/slack.js +++ b/server/notification-providers/slack.js @@ -27,10 +27,14 @@ class Slack extends NotificationProvider { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { let okMsg = "Sent Successfully."; + const finalMsg = notification.slackchannelmention + ? `${msg} ` + : msg; + try { if (heartbeatJSON == null) { let data = { - "text": msg, + "text": finalMsg, "channel": notification.slackchannel, "username": notification.slackusername, "icon_emoji": notification.slackiconemo, @@ -42,7 +46,7 @@ class Slack extends NotificationProvider { const time = heartbeatJSON["time"]; const textMsg = "Uptime Kuma Alert"; let data = { - "text": `${textMsg}\n${msg}`, + "text": `${textMsg}\n${finalMsg}`, "channel": notification.slackchannel, "username": notification.slackusername, "icon_emoji": notification.slackiconemo, @@ -54,14 +58,14 @@ class Slack extends NotificationProvider { "type": "header", "text": { "type": "plain_text", - "text": "Uptime Kuma Alert", + "text": textMsg, }, }, { "type": "section", "fields": [{ "type": "mrkdwn", - "text": "*Message*\n" + msg, + "text": "*Message*\n" + finalMsg, }, { "type": "mrkdwn", diff --git a/src/components/notifications/Slack.vue b/src/components/notifications/Slack.vue index 6d220caad..34ef5feb8 100644 --- a/src/components/notifications/Slack.vue +++ b/src/components/notifications/Slack.vue @@ -24,5 +24,11 @@ https://www.webfx.com/tools/emoji-cheat-sheet/ + +