diff --git a/server/monitor-types/monitor-type.js b/server/monitor-types/monitor-type.js index 782bedd5b..eb75307b2 100644 --- a/server/monitor-types/monitor-type.js +++ b/server/monitor-types/monitor-type.js @@ -1,5 +1,4 @@ class MonitorType { - name = undefined; /** diff --git a/server/notification-providers/alerta.js b/server/notification-providers/alerta.js index 62092178a..f9a273b49 100644 --- a/server/notification-providers/alerta.js +++ b/server/notification-providers/alerta.js @@ -3,17 +3,15 @@ const { DOWN, UP } = require("../../src/util"); const axios = require("axios"); class Alerta extends NotificationProvider { - name = "alerta"; /** * @inheritdoc */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { - let okMsg = "Sent Successfully."; + const okMsg = "Sent Successfully."; try { - let alertaUrl = `${notification.alertaApiEndpoint}`; let config = { headers: { "Content-Type": "application/json;charset=UTF-8", @@ -40,7 +38,7 @@ class Alerta extends NotificationProvider { resource: "Message", }, data); - await axios.post(alertaUrl, postData, config); + await axios.post(notification.alertaApiEndpoint, postData, config); } else { let datadup = Object.assign( { correlate: [ "service_up", "service_down" ], @@ -52,11 +50,11 @@ class Alerta extends NotificationProvider { if (heartbeatJSON["status"] === DOWN) { datadup.severity = notification.alertaAlertState; // critical datadup.text = "Service " + monitorJSON["type"] + " is down."; - await axios.post(alertaUrl, datadup, config); + await axios.post(notification.alertaApiEndpoint, datadup, config); } else if (heartbeatJSON["status"] === UP) { datadup.severity = notification.alertaRecoverState; // cleaned datadup.text = "Service " + monitorJSON["type"] + " is up."; - await axios.post(alertaUrl, datadup, config); + await axios.post(notification.alertaApiEndpoint, datadup, config); } } return okMsg; diff --git a/server/notification-providers/alertnow.js b/server/notification-providers/alertnow.js index 1206b72ec..4257ca9cd 100644 --- a/server/notification-providers/alertnow.js +++ b/server/notification-providers/alertnow.js @@ -4,14 +4,14 @@ const { setting } = require("../util-server"); const { getMonitorRelativeURL, UP, DOWN } = require("../../src/util"); class AlertNow extends NotificationProvider { - name = "AlertNow"; /** * @inheritdoc */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { - let okMsg = "Sent Successfully."; + const okMsg = "Sent Successfully."; + try { let textMsg = ""; let status = "open"; diff --git a/server/notification-providers/aliyun-sms.js b/server/notification-providers/aliyun-sms.js index 1718bbfe4..b895f70a1 100644 --- a/server/notification-providers/aliyun-sms.js +++ b/server/notification-providers/aliyun-sms.js @@ -11,7 +11,7 @@ class AliyunSMS extends NotificationProvider { * @inheritdoc */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { - let okMsg = "Sent Successfully."; + const okMsg = "Sent Successfully."; try { if (heartbeatJSON != null) { diff --git a/server/notification-providers/apprise.js b/server/notification-providers/apprise.js index 5e4d23c38..0f6982140 100644 --- a/server/notification-providers/apprise.js +++ b/server/notification-providers/apprise.js @@ -2,13 +2,14 @@ const NotificationProvider = require("./notification-provider"); const childProcessAsync = require("promisify-child-process"); class Apprise extends NotificationProvider { - name = "apprise"; /** * @inheritdoc */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { + const okMsg = "Sent Successfully."; + const args = [ "-vv", "-b", msg, notification.appriseURL ]; if (notification.title) { args.push("-t"); @@ -23,7 +24,7 @@ class Apprise extends NotificationProvider { if (output) { if (! output.includes("ERROR")) { - return "Sent Successfully"; + return okMsg; } throw new Error(output); diff --git a/server/notification-providers/bark.js b/server/notification-providers/bark.js index 7fe9a7a9f..4d6c0ae04 100644 --- a/server/notification-providers/bark.js +++ b/server/notification-providers/bark.js @@ -46,29 +46,29 @@ class Bark extends NotificationProvider { } /** - * Add additional parameter for Bark v1 endpoints + * Add additional parameter for Bark v1 endpoints. + * Leads to better on device styles (iOS 15 optimized) * @param {BeanModel} notification Notification to send - * @param {string} postUrl URL to append parameters to * @returns {string} Additional URL parameters */ - appendAdditionalParameters(notification, postUrl) { + additionalParameters(notification) { // set icon to uptime kuma icon, 11kb should be fine - postUrl += "?icon=" + barkNotificationAvatar; + let params = "?icon=" + barkNotificationAvatar; // grouping all our notifications if (notification.barkGroup != null) { - postUrl += "&group=" + notification.barkGroup; + params += "&group=" + notification.barkGroup; } else { // default name - postUrl += "&group=" + "UptimeKuma"; + params += "&group=" + "UptimeKuma"; } // picked a sound, this should follow system's mute status when arrival if (notification.barkSound != null) { - postUrl += "&sound=" + notification.barkSound; + params += "&sound=" + notification.barkSound; } else { // default sound - postUrl += "&sound=" + "telegraph"; + params += "&sound=" + "telegraph"; } - return postUrl; + return params; } /** @@ -100,9 +100,8 @@ class Bark extends NotificationProvider { // url encode title and subtitle title = encodeURIComponent(title); subtitle = encodeURIComponent(subtitle); - let postUrl = endpoint + "/" + title + "/" + subtitle; - postUrl = this.appendAdditionalParameters(notification, postUrl); - result = await axios.get(postUrl); + const params = this.additionalParameters(notification); + result = await axios.get(`${endpoint}/${title}/${subtitle}${params}`); } else { result = await axios.post(`${endpoint}/push`, { title, diff --git a/server/notification-providers/clicksendsms.js b/server/notification-providers/clicksendsms.js index 5539a6a4a..c090b7f36 100644 --- a/server/notification-providers/clicksendsms.js +++ b/server/notification-providers/clicksendsms.js @@ -2,14 +2,15 @@ const NotificationProvider = require("./notification-provider"); const axios = require("axios"); class ClickSendSMS extends NotificationProvider { - name = "clicksendsms"; /** * @inheritdoc */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { - let okMsg = "Sent Successfully."; + const okMsg = "Sent Successfully."; + const url = "https://rest.clicksend.com/v3/sms/send"; + try { let config = { headers: { @@ -28,7 +29,7 @@ class ClickSendSMS extends NotificationProvider { } ] }; - let resp = await axios.post("https://rest.clicksend.com/v3/sms/send", data, config); + let resp = await axios.post(url, data, config); if (resp.data.data.messages[0].status !== "SUCCESS") { let error = "Something gone wrong. Api returned " + resp.data.data.messages[0].status + "."; this.throwGeneralAxiosError(error); diff --git a/server/notification-providers/dingding.js b/server/notification-providers/dingding.js index be3a2fbc6..3aa819229 100644 --- a/server/notification-providers/dingding.js +++ b/server/notification-providers/dingding.js @@ -10,7 +10,7 @@ class DingDing extends NotificationProvider { * @inheritdoc */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { - let okMsg = "Sent Successfully."; + const okMsg = "Sent Successfully."; try { if (heartbeatJSON != null) { diff --git a/server/notification-providers/discord.js b/server/notification-providers/discord.js index f24cd6169..f24d47252 100644 --- a/server/notification-providers/discord.js +++ b/server/notification-providers/discord.js @@ -3,14 +3,13 @@ const axios = require("axios"); const { DOWN, UP } = require("../../src/util"); class Discord extends NotificationProvider { - name = "discord"; /** * @inheritdoc */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { - let okMsg = "Sent Successfully."; + const okMsg = "Sent Successfully."; try { const discordDisplayName = notification.discordUsername || "Uptime Kuma"; diff --git a/server/notification-providers/feishu.js b/server/notification-providers/feishu.js index dd5ce2954..23af69118 100644 --- a/server/notification-providers/feishu.js +++ b/server/notification-providers/feishu.js @@ -9,8 +9,7 @@ class Feishu extends NotificationProvider { * @inheritdoc */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { - let okMsg = "Sent Successfully."; - let feishuWebHookUrl = notification.feishuWebHookUrl; + const okMsg = "Sent Successfully."; try { if (heartbeatJSON == null) { @@ -20,7 +19,7 @@ class Feishu extends NotificationProvider { text: msg, }, }; - await axios.post(feishuWebHookUrl, testdata); + await axios.post(notification.feishuWebHookUrl, testdata); return okMsg; } @@ -46,7 +45,7 @@ class Feishu extends NotificationProvider { }, }, }; - await axios.post(feishuWebHookUrl, downdata); + await axios.post(notification.feishuWebHookUrl, downdata); return okMsg; } @@ -72,7 +71,7 @@ class Feishu extends NotificationProvider { }, }, }; - await axios.post(feishuWebHookUrl, updata); + await axios.post(notification.feishuWebHookUrl, updata); return okMsg; } } catch (error) { diff --git a/server/notification-providers/freemobile.js b/server/notification-providers/freemobile.js index 44c55bfd5..4de45acdd 100644 --- a/server/notification-providers/freemobile.js +++ b/server/notification-providers/freemobile.js @@ -2,14 +2,14 @@ const NotificationProvider = require("./notification-provider"); const axios = require("axios"); class FreeMobile extends NotificationProvider { - name = "FreeMobile"; /** * @inheritdoc */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { - let okMsg = "Sent Successfully."; + const okMsg = "Sent Successfully."; + try { await axios.post(`https://smsapi.free-mobile.fr/sendmsg?msg=${encodeURIComponent(msg.replace("🔴", "⛔️"))}`, { "user": notification.freemobileUser, diff --git a/server/notification-providers/goalert.js b/server/notification-providers/goalert.js index abf779241..847c6a003 100644 --- a/server/notification-providers/goalert.js +++ b/server/notification-providers/goalert.js @@ -3,21 +3,20 @@ const axios = require("axios"); const { UP } = require("../../src/util"); class GoAlert extends NotificationProvider { - name = "GoAlert"; /** * @inheritdoc */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { - let okMsg = "Sent Successfully."; + const okMsg = "Sent Successfully."; + try { - let closeAction = "close"; let data = { summary: msg, }; if (heartbeatJSON != null && heartbeatJSON["status"] === UP) { - data["action"] = closeAction; + data["action"] = "close"; } let headers = { "Content-Type": "multipart/form-data", @@ -27,7 +26,6 @@ class GoAlert extends NotificationProvider { }; await axios.post(`${notification.goAlertBaseURL}/api/v2/generic/incoming?token=${notification.goAlertToken}`, data, config); return okMsg; - } catch (error) { let msg = (error.response.data) ? error.response.data : "Error without response"; throw new Error(msg); diff --git a/server/notification-providers/google-chat.js b/server/notification-providers/google-chat.js index 413fde26d..9f1b53b7b 100644 --- a/server/notification-providers/google-chat.js +++ b/server/notification-providers/google-chat.js @@ -5,14 +5,14 @@ const { getMonitorRelativeURL } = require("../../src/util"); const { DOWN, UP } = require("../../src/util"); class GoogleChat extends NotificationProvider { - name = "GoogleChat"; /** * @inheritdoc */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { - let okMsg = "Sent Successfully."; + const okMsg = "Sent Successfully."; + try { // Google Chat message formatting: https://developers.google.com/chat/api/guides/message-formats/basic diff --git a/server/notification-providers/gorush.js b/server/notification-providers/gorush.js index 28f03ab98..ba9d470f7 100644 --- a/server/notification-providers/gorush.js +++ b/server/notification-providers/gorush.js @@ -2,14 +2,13 @@ const NotificationProvider = require("./notification-provider"); const axios = require("axios"); class Gorush extends NotificationProvider { - name = "gorush"; /** * @inheritdoc */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { - let okMsg = "Sent Successfully."; + const okMsg = "Sent Successfully."; let platformMapping = { "ios": 1, diff --git a/server/notification-providers/gotify.js b/server/notification-providers/gotify.js index 3e99b3d1a..a52ef511a 100644 --- a/server/notification-providers/gotify.js +++ b/server/notification-providers/gotify.js @@ -2,14 +2,14 @@ const NotificationProvider = require("./notification-provider"); const axios = require("axios"); class Gotify extends NotificationProvider { - name = "gotify"; /** * @inheritdoc */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { - let okMsg = "Sent Successfully."; + const okMsg = "Sent Successfully."; + try { if (notification.gotifyserverurl && notification.gotifyserverurl.endsWith("/")) { notification.gotifyserverurl = notification.gotifyserverurl.slice(0, -1); diff --git a/server/notification-providers/grafana-oncall.js b/server/notification-providers/grafana-oncall.js index ee1bfd479..e93c77cd9 100644 --- a/server/notification-providers/grafana-oncall.js +++ b/server/notification-providers/grafana-oncall.js @@ -3,19 +3,18 @@ const axios = require("axios"); const { DOWN, UP } = require("../../src/util"); class GrafanaOncall extends NotificationProvider { - name = "GrafanaOncall"; /** * @inheritdoc */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { + const okMsg = "Sent Successfully."; if (!notification.GrafanaOncallURL) { throw new Error("GrafanaOncallURL cannot be empty"); } - let okMsg = "Sent Successfully."; try { if (heartbeatJSON === null) { let grafanaupdata = { @@ -23,10 +22,7 @@ class GrafanaOncall extends NotificationProvider { message: msg, state: "alerting", }; - await axios.post( - notification.GrafanaOncallURL, - grafanaupdata - ); + await axios.post(notification.GrafanaOncallURL, grafanaupdata); return okMsg; } else if (heartbeatJSON["status"] === DOWN) { let grafanadowndata = { @@ -34,10 +30,7 @@ class GrafanaOncall extends NotificationProvider { message: heartbeatJSON["msg"], state: "alerting", }; - await axios.post( - notification.GrafanaOncallURL, - grafanadowndata - ); + await axios.post(notification.GrafanaOncallURL, grafanadowndata); return okMsg; } else if (heartbeatJSON["status"] === UP) { let grafanaupdata = { @@ -45,10 +38,7 @@ class GrafanaOncall extends NotificationProvider { message: heartbeatJSON["msg"], state: "ok", }; - await axios.post( - notification.GrafanaOncallURL, - grafanaupdata - ); + await axios.post(notification.GrafanaOncallURL, grafanaupdata); return okMsg; } } catch (error) { diff --git a/server/notification-providers/home-assistant.js b/server/notification-providers/home-assistant.js index 292fc3e67..ee95ba0bf 100644 --- a/server/notification-providers/home-assistant.js +++ b/server/notification-providers/home-assistant.js @@ -9,7 +9,9 @@ class HomeAssistant extends NotificationProvider { /** * @inheritdoc */ - async send(notification, message, monitor = null, heartbeat = null) { + async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { + const okMsg = "Sent Successfully."; + const notificationService = notification?.notificationService || defaultNotificationService; try { @@ -17,10 +19,10 @@ class HomeAssistant extends NotificationProvider { `${notification.homeAssistantUrl.trim().replace(/\/*$/, "")}/api/services/notify/${notificationService}`, { title: "Uptime Kuma", - message, + message: msg, ...(notificationService !== "persistent_notification" && { data: { - name: monitor?.name, - status: heartbeat?.status, + name: monitorJSON?.name, + status: heartbeatJSON?.status, } }), }, { @@ -31,7 +33,7 @@ class HomeAssistant extends NotificationProvider { } ); - return "Sent Successfully."; + return okMsg; } catch (error) { this.throwGeneralAxiosError(error); } diff --git a/server/notification-providers/kook.js b/server/notification-providers/kook.js index b9b68f436..dab19513a 100644 --- a/server/notification-providers/kook.js +++ b/server/notification-providers/kook.js @@ -2,15 +2,15 @@ const NotificationProvider = require("./notification-provider"); const axios = require("axios"); class Kook extends NotificationProvider { - name = "Kook"; /** * @inheritdoc */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { - let okMsg = "Sent Successfully."; - let url = "https://www.kookapp.cn/api/v3/message/create"; + const okMsg = "Sent Successfully."; + const url = "https://www.kookapp.cn/api/v3/message/create"; + let data = { target_id: notification.kookGuildID, content: msg, diff --git a/server/notification-providers/line.js b/server/notification-providers/line.js index 73dc962f4..57dc87e78 100644 --- a/server/notification-providers/line.js +++ b/server/notification-providers/line.js @@ -3,16 +3,16 @@ const axios = require("axios"); const { DOWN, UP } = require("../../src/util"); class Line extends NotificationProvider { - name = "line"; /** * @inheritdoc */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { - let okMsg = "Sent Successfully."; + const okMsg = "Sent Successfully."; + const url = "https://api.line.me/v2/bot/message/push"; + try { - let lineAPIUrl = "https://api.line.me/v2/bot/message/push"; let config = { headers: { "Content-Type": "application/json", @@ -29,7 +29,7 @@ class Line extends NotificationProvider { } ] }; - await axios.post(lineAPIUrl, testMessage, config); + await axios.post(url, testMessage, config); } else if (heartbeatJSON["status"] === DOWN) { let downMessage = { "to": notification.lineUserID, @@ -43,7 +43,7 @@ class Line extends NotificationProvider { } ] }; - await axios.post(lineAPIUrl, downMessage, config); + await axios.post(url, downMessage, config); } else if (heartbeatJSON["status"] === UP) { let upMessage = { "to": notification.lineUserID, @@ -57,7 +57,7 @@ class Line extends NotificationProvider { } ] }; - await axios.post(lineAPIUrl, upMessage, config); + await axios.post(url, upMessage, config); } return okMsg; } catch (error) { diff --git a/server/notification-providers/linenotify.js b/server/notification-providers/linenotify.js index dfe7e598a..2622e3f1c 100644 --- a/server/notification-providers/linenotify.js +++ b/server/notification-providers/linenotify.js @@ -4,16 +4,16 @@ const qs = require("qs"); const { DOWN, UP } = require("../../src/util"); class LineNotify extends NotificationProvider { - name = "LineNotify"; /** * @inheritdoc */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { - let okMsg = "Sent Successfully."; + const okMsg = "Sent Successfully."; + const url = "https://notify-api.line.me/api/notify"; + try { - let lineAPIUrl = "https://notify-api.line.me/api/notify"; let config = { headers: { "Content-Type": "application/x-www-form-urlencoded", @@ -24,7 +24,7 @@ class LineNotify extends NotificationProvider { let testMessage = { "message": msg, }; - await axios.post(lineAPIUrl, qs.stringify(testMessage), config); + await axios.post(url, qs.stringify(testMessage), config); } else if (heartbeatJSON["status"] === DOWN) { let downMessage = { "message": "\n[🔴 Down]\n" + @@ -32,7 +32,7 @@ class LineNotify extends NotificationProvider { heartbeatJSON["msg"] + "\n" + `Time (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}` }; - await axios.post(lineAPIUrl, qs.stringify(downMessage), config); + await axios.post(url, qs.stringify(downMessage), config); } else if (heartbeatJSON["status"] === UP) { let upMessage = { "message": "\n[✅ Up]\n" + @@ -40,7 +40,7 @@ class LineNotify extends NotificationProvider { heartbeatJSON["msg"] + "\n" + `Time (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}` }; - await axios.post(lineAPIUrl, qs.stringify(upMessage), config); + await axios.post(url, qs.stringify(upMessage), config); } return okMsg; } catch (error) { diff --git a/server/notification-providers/lunasea.js b/server/notification-providers/lunasea.js index 3729b0fe4..787a704a9 100644 --- a/server/notification-providers/lunasea.js +++ b/server/notification-providers/lunasea.js @@ -3,28 +3,23 @@ const axios = require("axios"); const { DOWN, UP } = require("../../src/util"); class LunaSea extends NotificationProvider { - name = "lunasea"; /** * @inheritdoc */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { - let okMsg = "Sent Successfully."; - let lunaseaurl = ""; - if (notification.lunaseaTarget === "user") { - lunaseaurl = "https://notify.lunasea.app/v1/custom/user/" + notification.lunaseaUserID; - } else { - lunaseaurl = "https://notify.lunasea.app/v1/custom/device/" + notification.lunaseaDevice; - } + const okMsg = "Sent Successfully."; + const url = "https://notify.lunasea.app/v1"; try { + const target = this.getTarget(notification); if (heartbeatJSON == null) { let testdata = { "title": "Uptime Kuma Alert", "body": msg, }; - await axios.post(lunaseaurl, testdata); + await axios.post(`${url}/custom/${target}`, testdata); return okMsg; } @@ -35,7 +30,7 @@ class LunaSea extends NotificationProvider { heartbeatJSON["msg"] + `\nTime (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}` }; - await axios.post(lunaseaurl, downdata); + await axios.post(`${url}/custom/${target}`, downdata); return okMsg; } @@ -46,13 +41,25 @@ class LunaSea extends NotificationProvider { heartbeatJSON["msg"] + `\nTime (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}` }; - await axios.post(lunaseaurl, updata); + await axios.post(`${url}/custom/${target}`, updata); return okMsg; } } catch (error) { this.throwGeneralAxiosError(error); } + } + + /** + * Generates the lunasea target to send the notification to + * @param {BeanModel} notification Notification details + * @returns {string} The target to send the notification to + */ + getTarget(notification) { + if (notification.lunaseaTarget === "user") { + return "user/" + notification.lunaseaUserID; + } + return "device/" + notification.lunaseaDevice; } } diff --git a/server/notification-providers/matrix.js b/server/notification-providers/matrix.js index c9baf48bc..805a49470 100644 --- a/server/notification-providers/matrix.js +++ b/server/notification-providers/matrix.js @@ -10,7 +10,7 @@ class Matrix extends NotificationProvider { * @inheritdoc */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { - let okMsg = "Sent Successfully."; + const okMsg = "Sent Successfully."; const size = 20; const randomString = encodeURIComponent( diff --git a/server/notification-providers/mattermost.js b/server/notification-providers/mattermost.js index 5a6a8e2c5..9946d02b2 100644 --- a/server/notification-providers/mattermost.js +++ b/server/notification-providers/mattermost.js @@ -3,14 +3,14 @@ const axios = require("axios"); const { DOWN, UP } = require("../../src/util"); class Mattermost extends NotificationProvider { - name = "mattermost"; /** * @inheritdoc */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { - let okMsg = "Sent Successfully."; + const okMsg = "Sent Successfully."; + try { const mattermostUserName = notification.mattermostusername || "Uptime Kuma"; // If heartbeatJSON is null, assume non monitoring notification (Certificate warning) or testing. @@ -98,10 +98,7 @@ class Mattermost extends NotificationProvider { }, ], }; - await axios.post( - notification.mattermostWebhookUrl, - mattermostdata - ); + await axios.post(notification.mattermostWebhookUrl, mattermostdata); return okMsg; } catch (error) { this.throwGeneralAxiosError(error); diff --git a/server/notification-providers/ntfy.js b/server/notification-providers/ntfy.js index 12c9258b8..ad1d39f8f 100644 --- a/server/notification-providers/ntfy.js +++ b/server/notification-providers/ntfy.js @@ -3,14 +3,14 @@ const axios = require("axios"); const { DOWN, UP } = require("../../src/util"); class Ntfy extends NotificationProvider { - name = "ntfy"; /** * @inheritdoc */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { - let okMsg = "Sent Successfully."; + const okMsg = "Sent Successfully."; + try { let headers = {}; if (notification.ntfyAuthenticationMethod === "usernamePassword") { @@ -31,7 +31,7 @@ class Ntfy extends NotificationProvider { "priority": notification.ntfyPriority, "tags": [ "test_tube" ], }; - await axios.post(`${notification.ntfyserverurl}`, ntfyTestData, { headers: headers }); + await axios.post(notification.ntfyserverurl, ntfyTestData, { headers: headers }); return okMsg; } let tags = []; @@ -70,7 +70,7 @@ class Ntfy extends NotificationProvider { data.icon = notification.ntfyIcon; } - await axios.post(`${notification.ntfyserverurl}`, data, { headers: headers }); + await axios.post(notification.ntfyserverurl, data, { headers: headers }); return okMsg; diff --git a/server/notification-providers/octopush.js b/server/notification-providers/octopush.js index ec62cd3ad..7576e0ad6 100644 --- a/server/notification-providers/octopush.js +++ b/server/notification-providers/octopush.js @@ -2,14 +2,15 @@ const NotificationProvider = require("./notification-provider"); const axios = require("axios"); class Octopush extends NotificationProvider { - name = "octopush"; /** * @inheritdoc */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { - let okMsg = "Sent Successfully."; + const okMsg = "Sent Successfully."; + const urlV2 = "https://api.octopush.com/v1/public/sms-campaign/send"; + const urlV1 = "https://www.octopush-dm.com/api/sms/json"; try { // Default - V2 @@ -33,7 +34,7 @@ class Octopush extends NotificationProvider { "purpose": "alert", "sender": notification.octopushSenderName }; - await axios.post("https://api.octopush.com/v1/public/sms-campaign/send", data, config); + await axios.post(urlV2, data, config); } else if (notification.octopushVersion === "1") { let data = { "user_login": notification.octopushDMLogin, @@ -55,7 +56,7 @@ class Octopush extends NotificationProvider { // V1 API returns 200 even on error so we must check // response data - let response = await axios.post("https://www.octopush-dm.com/api/sms/json", {}, config); + let response = await axios.post(urlV1, {}, config); if ("error_code" in response.data) { if (response.data.error_code !== "000") { this.throwGeneralAxiosError(`Octopush error ${JSON.stringify(response.data)}`); diff --git a/server/notification-providers/onebot.js b/server/notification-providers/onebot.js index ec7fc46d4..b04794dee 100644 --- a/server/notification-providers/onebot.js +++ b/server/notification-providers/onebot.js @@ -2,23 +2,23 @@ const NotificationProvider = require("./notification-provider"); const axios = require("axios"); class OneBot extends NotificationProvider { - name = "OneBot"; /** * @inheritdoc */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { - let okMsg = "Sent Successfully."; + const okMsg = "Sent Successfully."; + try { - let httpAddr = notification.httpAddr; - if (!httpAddr.startsWith("http")) { - httpAddr = "http://" + httpAddr; + let url = notification.httpAddr; + if (!url.startsWith("http")) { + url = "http://" + url; } - if (!httpAddr.endsWith("/")) { - httpAddr += "/"; + if (!url.endsWith("/")) { + url += "/"; } - let onebotAPIUrl = httpAddr + "send_msg"; + url += "send_msg"; let config = { headers: { "Content-Type": "application/json", @@ -37,7 +37,7 @@ class OneBot extends NotificationProvider { data["message_type"] = "private"; data["user_id"] = notification.recieverId; } - await axios.post(onebotAPIUrl, data, config); + await axios.post(url, data, config); return okMsg; } catch (error) { this.throwGeneralAxiosError(error); diff --git a/server/notification-providers/opsgenie.js b/server/notification-providers/opsgenie.js index e2dc38a7c..59a797055 100644 --- a/server/notification-providers/opsgenie.js +++ b/server/notification-providers/opsgenie.js @@ -4,10 +4,9 @@ const { UP, DOWN } = require("../../src/util"); const opsgenieAlertsUrlEU = "https://api.eu.opsgenie.com/v2/alerts"; const opsgenieAlertsUrlUS = "https://api.opsgenie.com/v2/alerts"; -let okMsg = "Sent Successfully."; +const okMsg = "Sent Successfully."; class Opsgenie extends NotificationProvider { - name = "Opsgenie"; /** diff --git a/server/notification-providers/promosms.js b/server/notification-providers/promosms.js index 7ec919714..05334e902 100644 --- a/server/notification-providers/promosms.js +++ b/server/notification-providers/promosms.js @@ -2,14 +2,14 @@ const NotificationProvider = require("./notification-provider"); const axios = require("axios"); class PromoSMS extends NotificationProvider { - name = "promosms"; /** * @inheritdoc */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { - let okMsg = "Sent Successfully."; + const okMsg = "Sent Successfully."; + const url = "https://promosms.com/api/rest/v3_2/sms"; if (notification.promosmsAllowLongSMS === undefined) { notification.promosmsAllowLongSMS = false; @@ -36,7 +36,7 @@ class PromoSMS extends NotificationProvider { "sender": notification.promosmsSenderName }; - let resp = await axios.post("https://promosms.com/api/rest/v3_2/sms", data, config); + let resp = await axios.post(url, data, config); if (resp.data.response.status !== 0) { let error = "Something gone wrong. Api returned " + resp.data.response.status + "."; diff --git a/server/notification-providers/pushbullet.js b/server/notification-providers/pushbullet.js index 9fbd4d4c0..0b7303103 100644 --- a/server/notification-providers/pushbullet.js +++ b/server/notification-providers/pushbullet.js @@ -4,17 +4,16 @@ const axios = require("axios"); const { DOWN, UP } = require("../../src/util"); class Pushbullet extends NotificationProvider { - name = "pushbullet"; /** * @inheritdoc */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { - let okMsg = "Sent Successfully."; + const okMsg = "Sent Successfully."; + const url = "https://api.pushbullet.com/v2/pushes"; try { - let pushbulletUrl = "https://api.pushbullet.com/v2/pushes"; let config = { headers: { "Access-Token": notification.pushbulletAccessToken, @@ -27,7 +26,7 @@ class Pushbullet extends NotificationProvider { "title": "Uptime Kuma Alert", "body": msg, }; - await axios.post(pushbulletUrl, data, config); + await axios.post(url, data, config); } else if (heartbeatJSON["status"] === DOWN) { let downData = { "type": "note", @@ -36,7 +35,7 @@ class Pushbullet extends NotificationProvider { heartbeatJSON["msg"] + `\nTime (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`, }; - await axios.post(pushbulletUrl, downData, config); + await axios.post(url, downData, config); } else if (heartbeatJSON["status"] === UP) { let upData = { "type": "note", @@ -45,7 +44,7 @@ class Pushbullet extends NotificationProvider { heartbeatJSON["msg"] + `\nTime (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`, }; - await axios.post(pushbulletUrl, upData, config); + await axios.post(url, upData, config); } return okMsg; } catch (error) { diff --git a/server/notification-providers/pushdeer.js b/server/notification-providers/pushdeer.js index 78525a54f..276c2f476 100644 --- a/server/notification-providers/pushdeer.js +++ b/server/notification-providers/pushdeer.js @@ -3,17 +3,15 @@ const axios = require("axios"); const { DOWN, UP } = require("../../src/util"); class PushDeer extends NotificationProvider { - name = "PushDeer"; /** * @inheritdoc */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { - let okMsg = "Sent Successfully."; - let endpoint = "/message/push"; - let serverUrl = notification.pushdeerServer || "https://api2.pushdeer.com"; - let pushdeerlink = `${serverUrl.trim().replace(/\/*$/, "")}${endpoint}`; + const okMsg = "Sent Successfully."; + const serverUrl = notification.pushdeerServer || "https://api2.pushdeer.com"; + const url = `${serverUrl.trim().replace(/\/*$/, "")}/message/push`; let valid = msg != null && monitorJSON != null && heartbeatJSON != null; @@ -34,7 +32,7 @@ class PushDeer extends NotificationProvider { }; try { - let res = await axios.post(pushdeerlink, data); + let res = await axios.post(url, data); if ("error" in res.data) { let error = res.data.error; diff --git a/server/notification-providers/pushover.js b/server/notification-providers/pushover.js index 31f8d885e..304aa3519 100644 --- a/server/notification-providers/pushover.js +++ b/server/notification-providers/pushover.js @@ -2,15 +2,14 @@ const NotificationProvider = require("./notification-provider"); const axios = require("axios"); class Pushover extends NotificationProvider { - name = "pushover"; /** * @inheritdoc */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { - let okMsg = "Sent Successfully."; - let pushoverlink = "https://api.pushover.net/1/messages.json"; + const okMsg = "Sent Successfully."; + const url = "https://api.pushover.net/1/messages.json"; let data = { "message": msg, @@ -33,11 +32,11 @@ class Pushover extends NotificationProvider { try { if (heartbeatJSON == null) { - await axios.post(pushoverlink, data); + await axios.post(url, data); return okMsg; } else { data.message += `\nTime (${heartbeatJSON["timezone"]}):${heartbeatJSON["localDateTime"]}`; - await axios.post(pushoverlink, data); + await axios.post(url, data); return okMsg; } } catch (error) { diff --git a/server/notification-providers/pushy.js b/server/notification-providers/pushy.js index afb9e617d..cb700229a 100644 --- a/server/notification-providers/pushy.js +++ b/server/notification-providers/pushy.js @@ -2,14 +2,13 @@ const NotificationProvider = require("./notification-provider"); const axios = require("axios"); class Pushy extends NotificationProvider { - name = "pushy"; /** * @inheritdoc */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { - let okMsg = "Sent Successfully."; + const okMsg = "Sent Successfully."; try { await axios.post(`https://api.pushy.me/push?api_key=${notification.pushyAPIKey}`, { diff --git a/server/notification-providers/rocket-chat.js b/server/notification-providers/rocket-chat.js index 13b39cde6..690e33a86 100644 --- a/server/notification-providers/rocket-chat.js +++ b/server/notification-providers/rocket-chat.js @@ -5,14 +5,14 @@ const { setting } = require("../util-server"); const { getMonitorRelativeURL, DOWN } = require("../../src/util"); class RocketChat extends NotificationProvider { - name = "rocket.chat"; /** * @inheritdoc */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { - let okMsg = "Sent Successfully."; + const okMsg = "Sent Successfully."; + try { if (heartbeatJSON == null) { let data = { diff --git a/server/notification-providers/serverchan.js b/server/notification-providers/serverchan.js index 2315e1c33..cefe61f14 100644 --- a/server/notification-providers/serverchan.js +++ b/server/notification-providers/serverchan.js @@ -3,14 +3,14 @@ const axios = require("axios"); const { DOWN, UP } = require("../../src/util"); class ServerChan extends NotificationProvider { - name = "ServerChan"; /** * @inheritdoc */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { - let okMsg = "Sent Successfully."; + const okMsg = "Sent Successfully."; + try { await axios.post(`https://sctapi.ftqq.com/${notification.serverChanSendKey}.send`, { "title": this.checkStatus(heartbeatJSON, monitorJSON), diff --git a/server/notification-providers/serwersms.js b/server/notification-providers/serwersms.js index 76e1ef2c1..f7c8644af 100644 --- a/server/notification-providers/serwersms.js +++ b/server/notification-providers/serwersms.js @@ -2,14 +2,14 @@ const NotificationProvider = require("./notification-provider"); const axios = require("axios"); class SerwerSMS extends NotificationProvider { - name = "serwersms"; /** * @inheritdoc */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { - let okMsg = "Sent Successfully."; + const okMsg = "Sent Successfully."; + const url = "https://api2.serwersms.pl/messages/send_sms"; try { let config = { @@ -25,7 +25,7 @@ class SerwerSMS extends NotificationProvider { "sender": notification.serwersmsSenderName, }; - let resp = await axios.post("https://api2.serwersms.pl/messages/send_sms", data, config); + let resp = await axios.post(url, data, config); if (!resp.data.success) { if (resp.data.error) { diff --git a/server/notification-providers/signal.js b/server/notification-providers/signal.js index c445ee825..9702d06bb 100644 --- a/server/notification-providers/signal.js +++ b/server/notification-providers/signal.js @@ -2,14 +2,13 @@ const NotificationProvider = require("./notification-provider"); const axios = require("axios"); class Signal extends NotificationProvider { - name = "signal"; /** * @inheritdoc */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { - let okMsg = "Sent Successfully."; + const okMsg = "Sent Successfully."; try { let data = { diff --git a/server/notification-providers/slack.js b/server/notification-providers/slack.js index d512a7cd8..9347b07c9 100644 --- a/server/notification-providers/slack.js +++ b/server/notification-providers/slack.js @@ -4,7 +4,6 @@ const { setSettings, setting } = require("../util-server"); const { getMonitorRelativeURL, UP } = require("../../src/util"); class Slack extends NotificationProvider { - name = "slack"; /** @@ -31,7 +30,7 @@ class Slack extends NotificationProvider { * @inheritdoc */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { - let okMsg = "Sent Successfully."; + const okMsg = "Sent Successfully."; if (notification.slackchannelnotify) { msg += " "; diff --git a/server/notification-providers/smsc.js b/server/notification-providers/smsc.js index 34d9c8fa0..89f01d01d 100644 --- a/server/notification-providers/smsc.js +++ b/server/notification-providers/smsc.js @@ -8,7 +8,9 @@ class SMSC extends NotificationProvider { * @inheritdoc */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { - let okMsg = "Sent Successfully."; + const okMsg = "Sent Successfully."; + const url = "https://smsc.kz/sys/send.php?"; + try { let config = { headers: { @@ -29,7 +31,7 @@ class SMSC extends NotificationProvider { getArray.push("sender=" + notification.smscSenderName); } - let resp = await axios.get("https://smsc.kz/sys/send.php?" + getArray.join("&"), config); + let resp = await axios.get(url + getArray.join("&"), config); if (resp.data.id === undefined) { let error = `Something gone wrong. Api returned code ${resp.data.error_code}: ${resp.data.error}`; this.throwGeneralAxiosError(error); diff --git a/server/notification-providers/smseagle.js b/server/notification-providers/smseagle.js index 988f17fdb..4e897006c 100644 --- a/server/notification-providers/smseagle.js +++ b/server/notification-providers/smseagle.js @@ -2,14 +2,13 @@ const NotificationProvider = require("./notification-provider"); const axios = require("axios"); class SMSEagle extends NotificationProvider { - name = "SMSEagle"; /** * @inheritdoc */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { - let okMsg = "Sent Successfully."; + const okMsg = "Sent Successfully."; try { let config = { diff --git a/server/notification-providers/smsmanager.js b/server/notification-providers/smsmanager.js index 7d55d4107..d01285d88 100644 --- a/server/notification-providers/smsmanager.js +++ b/server/notification-providers/smsmanager.js @@ -2,23 +2,24 @@ const NotificationProvider = require("./notification-provider"); const axios = require("axios"); class SMSManager extends NotificationProvider { - name = "SMSManager"; /** * @inheritdoc */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { + const okMsg = "Sent Successfully."; + const url = "https://http-api.smsmanager.cz/Send"; + try { let data = { apikey: notification.smsmanagerApiKey, - endpoint: "https://http-api.smsmanager.cz/Send", message: msg.replace(/[^\x00-\x7F]/g, ""), - to: notification.numbers, - messageType: notification.messageType, + number: notification.numbers, + gateway: notification.messageType, }; - await axios.get(`${data.endpoint}?apikey=${data.apikey}&message=${data.message}&number=${data.to}&gateway=${data.messageType}`); - return "SMS sent sucessfully."; + await axios.get(`${url}?apikey=${data.apikey}&message=${data.message}&number=${data.number}&gateway=${data.messageType}`); + return okMsg; } catch (error) { this.throwGeneralAxiosError(error); } diff --git a/server/notification-providers/smtp.js b/server/notification-providers/smtp.js index 0e761bc04..b403117b4 100644 --- a/server/notification-providers/smtp.js +++ b/server/notification-providers/smtp.js @@ -4,13 +4,13 @@ const { DOWN } = require("../../src/util"); const { Liquid } = require("liquidjs"); class SMTP extends NotificationProvider { - name = "smtp"; /** * @inheritdoc */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { + const okMsg = "Sent Successfully."; const config = { host: notification.smtpHost, @@ -76,7 +76,7 @@ class SMTP extends NotificationProvider { text: body, }); - return "Sent Successfully."; + return okMsg; } /** diff --git a/server/notification-providers/squadcast.js b/server/notification-providers/squadcast.js index 0b60503df..1c653d141 100644 --- a/server/notification-providers/squadcast.js +++ b/server/notification-providers/squadcast.js @@ -3,14 +3,13 @@ const axios = require("axios"); const { DOWN } = require("../../src/util"); class Squadcast extends NotificationProvider { - name = "squadcast"; /** * @inheritdoc */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { - let okMsg = "Sent Successfully."; + const okMsg = "Sent Successfully."; try { diff --git a/server/notification-providers/stackfield.js b/server/notification-providers/stackfield.js index 26c038ea7..65a92459a 100644 --- a/server/notification-providers/stackfield.js +++ b/server/notification-providers/stackfield.js @@ -4,14 +4,14 @@ const { setting } = require("../util-server"); const { getMonitorRelativeURL } = require("../../src/util"); class Stackfield extends NotificationProvider { - name = "stackfield"; /** * @inheritdoc */ - async send(notification, msg, monitorJSON = null) { - let okMsg = "Sent Successfully."; + async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { + const okMsg = "Sent Successfully."; + try { // Stackfield message formatting: https://www.stackfield.com/help/formatting-messages-2001 diff --git a/server/notification-providers/teams.js b/server/notification-providers/teams.js index bf2cd7647..f34ba1ced 100644 --- a/server/notification-providers/teams.js +++ b/server/notification-providers/teams.js @@ -208,7 +208,7 @@ class Teams extends NotificationProvider { * @inheritdoc */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { - let okMsg = "Sent Successfully."; + const okMsg = "Sent Successfully."; try { if (heartbeatJSON == null) { diff --git a/server/notification-providers/techulus-push.js b/server/notification-providers/techulus-push.js index bfd9503b9..230897f3c 100644 --- a/server/notification-providers/techulus-push.js +++ b/server/notification-providers/techulus-push.js @@ -2,14 +2,13 @@ const NotificationProvider = require("./notification-provider"); const axios = require("axios"); class TechulusPush extends NotificationProvider { - name = "PushByTechulus"; /** * @inheritdoc */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { - let okMsg = "Sent Successfully."; + const okMsg = "Sent Successfully."; try { await axios.post(`https://push.techulus.com/api/v1/notify/${notification.pushAPIKey}`, { diff --git a/server/notification-providers/telegram.js b/server/notification-providers/telegram.js index 896b9e08d..c5bbb1909 100644 --- a/server/notification-providers/telegram.js +++ b/server/notification-providers/telegram.js @@ -2,14 +2,14 @@ const NotificationProvider = require("./notification-provider"); const axios = require("axios"); class Telegram extends NotificationProvider { - name = "telegram"; /** * @inheritdoc */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { - let okMsg = "Sent Successfully."; + const okMsg = "Sent Successfully."; + const url = "https://api.telegram.org"; try { let params = { @@ -22,7 +22,7 @@ class Telegram extends NotificationProvider { params.message_thread_id = notification.telegramMessageThreadID; } - await axios.get(`https://api.telegram.org/bot${notification.telegramBotToken}/sendMessage`, { + await axios.get(`${url}/bot${notification.telegramBotToken}/sendMessage`, { params: params, }); return okMsg; diff --git a/server/notification-providers/twilio.js b/server/notification-providers/twilio.js index 2abb38b98..c38a6d7ed 100644 --- a/server/notification-providers/twilio.js +++ b/server/notification-providers/twilio.js @@ -2,26 +2,21 @@ const NotificationProvider = require("./notification-provider"); const axios = require("axios"); class Twilio extends NotificationProvider { - name = "twilio"; /** * @inheritdoc */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { + const okMsg = "Sent Successfully."; - let okMsg = "Sent Successfully."; - - let accountSID = notification.twilioAccountSID; - let apiKey = notification.twilioApiKey ? notification.twilioApiKey : accountSID; - let authToken = notification.twilioAuthToken; + let apiKey = notification.twilioApiKey ? notification.twilioApiKey : notification.twilioAccountSID; try { - let config = { headers: { "Content-Type": "application/x-www-form-urlencoded;charset=utf-8", - "Authorization": "Basic " + Buffer.from(apiKey + ":" + authToken).toString("base64"), + "Authorization": "Basic " + Buffer.from(apiKey + ":" + notification.twilioAuthToken).toString("base64"), } }; @@ -30,9 +25,7 @@ class Twilio extends NotificationProvider { data.append("From", notification.twilioFromNumber); data.append("Body", msg); - let url = "https://api.twilio.com/2010-04-01/Accounts/" + accountSID + "/Messages.json"; - - await axios.post(url, data, config); + await axios.post(`https://api.twilio.com/2010-04-01/Accounts/${(notification.twilioAccountSID)}/Messages.json`, data, config); return okMsg; } catch (error) { diff --git a/server/notification-providers/webhook.js b/server/notification-providers/webhook.js index 597ef8467..986986d44 100644 --- a/server/notification-providers/webhook.js +++ b/server/notification-providers/webhook.js @@ -4,14 +4,13 @@ const FormData = require("form-data"); const { Liquid } = require("liquidjs"); class Webhook extends NotificationProvider { - name = "webhook"; /** * @inheritdoc */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { - let okMsg = "Sent Successfully."; + const okMsg = "Sent Successfully."; try { let data = { diff --git a/server/notification-providers/wecom.js b/server/notification-providers/wecom.js index ea30b26d5..03fa7c186 100644 --- a/server/notification-providers/wecom.js +++ b/server/notification-providers/wecom.js @@ -3,24 +3,22 @@ const axios = require("axios"); const { DOWN, UP } = require("../../src/util"); class WeCom extends NotificationProvider { - name = "WeCom"; /** * @inheritdoc */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { - let okMsg = "Sent Successfully."; + const okMsg = "Sent Successfully."; try { - let WeComUrl = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=" + notification.weComBotKey; let config = { headers: { "Content-Type": "application/json" } }; let body = this.composeMessage(heartbeatJSON, msg); - await axios.post(WeComUrl, body, config); + await axios.post(`https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=${notification.weComBotKey}`, body, config); return okMsg; } catch (error) { this.throwGeneralAxiosError(error); diff --git a/server/notification-providers/zoho-cliq.js b/server/notification-providers/zoho-cliq.js index 08653e3de..10381c81f 100644 --- a/server/notification-providers/zoho-cliq.js +++ b/server/notification-providers/zoho-cliq.js @@ -3,7 +3,6 @@ const axios = require("axios"); const { DOWN, UP } = require("../../src/util"); class ZohoCliq extends NotificationProvider { - name = "ZohoCliq"; /** @@ -80,7 +79,7 @@ class ZohoCliq extends NotificationProvider { * @inheritdoc */ async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { - let okMsg = "Sent Successfully."; + const okMsg = "Sent Successfully."; try { if (heartbeatJSON == null) {