diff --git a/server/notification-providers/46elks.js b/server/notification-providers/46elks.js new file mode 100644 index 0000000000..4b15e9fad7 --- /dev/null +++ b/server/notification-providers/46elks.js @@ -0,0 +1,35 @@ +const NotificationProvider = require("./notification-provider"); +const axios = require("axios"); + +class Elks extends NotificationProvider { + name = "Elks"; + + /** + * @inheritdoc + */ + async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { + const okMsg = "Sent Successfully."; + const url = "https://api.46elks.com/a1/sms"; + + try { + let data = new URLSearchParams(); + data.append("from", notification.elksFromNumber); + data.append("to", notification.elksToNumber ); + data.append("message", msg); + + const config = { + headers: { + "Authorization": "Basic " + Buffer.from(`${notification.elksUsername}:${notification.elksAuthToken}`).toString("base64") + } + }; + + await axios.post(url, data, config); + + return okMsg; + } catch (error) { + this.throwGeneralAxiosError(error); + } + } +} + +module.exports = Elks; diff --git a/server/notification-providers/techulus-push.js b/server/notification-providers/techulus-push.js index 230897f3ca..bf688b194d 100644 --- a/server/notification-providers/techulus-push.js +++ b/server/notification-providers/techulus-push.js @@ -10,11 +10,22 @@ class TechulusPush extends NotificationProvider { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { const okMsg = "Sent Successfully."; + let data = { + "title": notification?.pushTitle?.length ? notification.pushTitle : "Uptime-Kuma", + "body": msg, + "timeSensitive": notification.pushTimeSensitive ?? true, + }; + + if (notification.pushChannel) { + data.channel = notification.pushChannel; + } + + if (notification.pushSound) { + data.sound = notification.pushSound; + } + try { - await axios.post(`https://push.techulus.com/api/v1/notify/${notification.pushAPIKey}`, { - "title": "Uptime-Kuma", - "body": msg, - }); + await axios.post(`https://push.techulus.com/api/v1/notify/${notification.pushAPIKey}`, data); return okMsg; } catch (error) { this.throwGeneralAxiosError(error); diff --git a/server/notification.js b/server/notification.js index 60eae4d739..26daeb0428 100644 --- a/server/notification.js +++ b/server/notification.js @@ -11,6 +11,7 @@ const CallMeBot = require("./notification-providers/call-me-bot"); const SMSC = require("./notification-providers/smsc"); const DingDing = require("./notification-providers/dingding"); const Discord = require("./notification-providers/discord"); +const Elks = require("./notification-providers/46elks"); const Feishu = require("./notification-providers/feishu"); const FreeMobile = require("./notification-providers/freemobile"); const GoogleChat = require("./notification-providers/google-chat"); @@ -95,6 +96,7 @@ class Notification { new SMSC(), new DingDing(), new Discord(), + new Elks(), new Feishu(), new FreeMobile(), new GoogleChat(), diff --git a/src/components/NotificationDialog.vue b/src/components/NotificationDialog.vue index 864cbf5f4d..ec86d15f8a 100644 --- a/src/components/NotificationDialog.vue +++ b/src/components/NotificationDialog.vue @@ -118,6 +118,7 @@ export default { "clicksendsms": "ClickSend SMS", "CallMeBot": "CallMeBot (WhatsApp, Telegram Call, Facebook Messanger)", "discord": "Discord", + "Elks": "46elks", "GoogleChat": "Google Chat (Google Workspace)", "gorush": "Gorush", "gotify": "Gotify", diff --git a/src/components/notifications/46elks.vue b/src/components/notifications/46elks.vue new file mode 100644 index 0000000000..d29655bd51 --- /dev/null +++ b/src/components/notifications/46elks.vue @@ -0,0 +1,48 @@ + + + diff --git a/src/components/notifications/TechulusPush.vue b/src/components/notifications/TechulusPush.vue index bece17e273..bb2c27ad85 100644 --- a/src/components/notifications/TechulusPush.vue +++ b/src/components/notifications/TechulusPush.vue @@ -4,6 +4,53 @@ +
+ + +
+ +
+ + +
+ {{ $t("Alphanumerical string and hyphens only") }} +
+
+ +
+ + +
+ {{ $t("Custom sound to override default notification sound") }} +
+
+ +
+
+ + +
+
+ {{ $t("Time sensitive notifications will be delivered immediately, even if the device is in do not disturb mode.") }} +
+
+ https://docs.push.techulus.com @@ -16,5 +63,19 @@ export default { components: { HiddenInput, }, + mounted() { + if (typeof this.$parent.notification.pushTitle === "undefined") { + this.$parent.notification.pushTitle = "Uptime-Kuma"; + } + if (typeof this.$parent.notification.pushChannel === "undefined") { + this.$parent.notification.pushChannel = "uptime-kuma"; + } + if (typeof this.$parent.notification.pushSound === "undefined") { + this.$parent.notification.pushSound = "default"; + } + if (typeof this.$parent.notification.pushTimeSensitive === "undefined") { + this.$parent.notification.pushTimeSensitive = true; + } + }, }; diff --git a/src/components/notifications/index.js b/src/components/notifications/index.js index e5df6fe4ef..35a3a920ad 100644 --- a/src/components/notifications/index.js +++ b/src/components/notifications/index.js @@ -9,6 +9,7 @@ import CallMeBot from "./CallMeBot.vue"; import SMSC from "./SMSC.vue"; import DingDing from "./DingDing.vue"; import Discord from "./Discord.vue"; +import Elks from "./46elks.vue"; import Feishu from "./Feishu.vue"; import FreeMobile from "./FreeMobile.vue"; import GoogleChat from "./GoogleChat.vue"; @@ -82,6 +83,7 @@ const NotificationFormList = { "smsc": SMSC, "DingDing": DingDing, "discord": Discord, + "Elks": Elks, "Feishu": Feishu, "FreeMobile": FreeMobile, "GoogleChat": GoogleChat, diff --git a/src/lang/en.json b/src/lang/en.json index 968a3d9f89..c07e06fab4 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -1027,5 +1027,29 @@ "greater than": "greater than", "less than or equal to": "less than or equal to", "greater than or equal to": "greater than or equal to", - "record": "record" + "record": "record", + "Notification Channel": "Notification Channel", + "Sound": "Sound", + "Alphanumerical string and hyphens only": "Alphanumerical string and hyphens only", + "Arcade": "Arcade", + "Correct": "Correct", + "Fail":"Fail", + "Harp":"Harp", + "Reveal":"Reveal", + "Bubble":"Bubble", + "Doorbell":"Doorbell", + "Flute":"Flute", + "Money":"Money", + "Scifi":"Scifi", + "Clear":"Clear", + "Elevator":"Elevator", + "Guitar":"Guitar", + "Pop":"Pop", + "Custom sound to override default notification sound": "Custom sound to override default notification sound", + "Time Sensitive (iOS Only)": "Time Sensitive (iOS Only)", + "Time sensitive notifications will be delivered immediately, even if the device is in do not disturb mode.": "Time sensitive notifications will be delivered immediately, even if the device is in do not disturb mode.", + "From":"From", + "Can be found on:": "Can be found on: {0}", + "The phone number of the recipient in E.164 format.": "The phone number of the recipient in E.164 format.", + "Either a text sender ID or a phone number in E.164 format if you want to be able to receive replies.":"Either a text sender ID or a phone number in E.164 format if you want to be able to receive replies." }