From 4377f575d1b0c27f1a00165987b9bd5743783c86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20W=C3=B3jcik?= Date: Tue, 8 Aug 2023 12:38:35 +0200 Subject: [PATCH 2/3] add URL to slack notification --- server/notification-providers/slack.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/server/notification-providers/slack.js b/server/notification-providers/slack.js index 41c2bd02..b84bb314 100644 --- a/server/notification-providers/slack.js +++ b/server/notification-providers/slack.js @@ -27,11 +27,6 @@ class Slack extends NotificationProvider { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { let okMsg = "Sent Successfully."; - - if (notification.slackchannelnotify) { - msg += " "; - } - try { if (heartbeatJSON == null) { let data = { @@ -58,7 +53,7 @@ class Slack extends NotificationProvider { "type": "header", "text": { "type": "plain_text", - "text": textMsg, + "text": "Uptime Kuma Alert", }, }, { @@ -67,10 +62,15 @@ class Slack extends NotificationProvider { "type": "mrkdwn", "text": "*Message*\n" + msg, }, - { - "type": "mrkdwn", - "text": `*Time (${heartbeatJSON["timezone"]})*\n${heartbeatJSON["localDateTime"]}`, - }], + { + "type": "mrkdwn", + "text": `*Time (${heartbeatJSON["timezone"]})*\n${heartbeatJSON["localDateTime"]}`, + }, + { + "type": "mrkdwn", + "text": "*URL*\n" + monitorJSON.url, + }], + } ], } From ed44c23fa35fde1adb595bf91946fa81b54476aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20W=C3=B3jcik?= Date: Tue, 8 Aug 2023 12:40:57 +0200 Subject: [PATCH 3/3] add URL to slack notification --- server/notification-providers/slack.js | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/server/notification-providers/slack.js b/server/notification-providers/slack.js index b84bb314..b67627d1 100644 --- a/server/notification-providers/slack.js +++ b/server/notification-providers/slack.js @@ -27,6 +27,11 @@ class Slack extends NotificationProvider { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { let okMsg = "Sent Successfully."; + + if (notification.slackchannelnotify) { + msg += " "; + } + try { if (heartbeatJSON == null) { let data = { @@ -53,7 +58,7 @@ class Slack extends NotificationProvider { "type": "header", "text": { "type": "plain_text", - "text": "Uptime Kuma Alert", + "text": textMsg, }, }, { @@ -62,15 +67,14 @@ class Slack extends NotificationProvider { "type": "mrkdwn", "text": "*Message*\n" + msg, }, - { - "type": "mrkdwn", - "text": `*Time (${heartbeatJSON["timezone"]})*\n${heartbeatJSON["localDateTime"]}`, - }, - { - "type": "mrkdwn", - "text": "*URL*\n" + monitorJSON.url, - }], - + { + "type": "mrkdwn", + "text": `*Time (${heartbeatJSON["timezone"]})*\n${heartbeatJSON["localDateTime"]}`, + }, + { + "type": "mrkdwn", + "text": "*URL*\n" + monitorJSON.url, + }], } ], }