diff --git a/server/notification-providers/smsmanager.js b/server/notification-providers/smsmanager.js new file mode 100644 index 000000000..833bff60f --- /dev/null +++ b/server/notification-providers/smsmanager.js @@ -0,0 +1,25 @@ +const NotificationProvider = require("./notification-provider"); +const axios = require("axios"); + +class SMSManager extends NotificationProvider { + + name = "SMSManager"; + + async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { + 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, + }; + await axios.get(`${data.endpoint}?apikey=${data.apikey}&message=${data.message}&number=${data.to}&gateway=${data.messageType}`); + return "SMS sent sucessfully."; + } catch (error) { + this.throwGeneralAxiosError(error); + } + } +} + +module.exports = SMSManager; diff --git a/server/notification.js b/server/notification.js index 3306a53ac..6f71783b1 100644 --- a/server/notification.js +++ b/server/notification.js @@ -39,6 +39,7 @@ const Telegram = require("./notification-providers/telegram"); const Webhook = require("./notification-providers/webhook"); const WeCom = require("./notification-providers/wecom"); const GoAlert = require("./notification-providers/goalert"); +const SMSManager = require("./notification-providers/smsmanager"); class Notification { @@ -81,6 +82,7 @@ class Notification { new RocketChat(), new SerwerSMS(), new Signal(), + new SMSManager(), new Slack(), new SMTP(), new Stackfield(), diff --git a/src/components/notifications/SMSManager.vue b/src/components/notifications/SMSManager.vue new file mode 100644 index 000000000..25db624fc --- /dev/null +++ b/src/components/notifications/SMSManager.vue @@ -0,0 +1,31 @@ + diff --git a/src/components/notifications/index.js b/src/components/notifications/index.js index e5570c80a..07ed2cd1a 100644 --- a/src/components/notifications/index.js +++ b/src/components/notifications/index.js @@ -28,6 +28,7 @@ import Pushy from "./Pushy.vue"; import RocketChat from "./RocketChat.vue"; import SerwerSMS from "./SerwerSMS.vue"; import Signal from "./Signal.vue"; +import SMSManager from "./SMSManager.vue"; import Slack from "./Slack.vue"; import Stackfield from "./Stackfield.vue"; import STMP from "./SMTP.vue"; @@ -75,6 +76,7 @@ const NotificationFormList = { "rocket.chat": RocketChat, "serwersms": SerwerSMS, "signal": Signal, + "SMSManager": SMSManager, "slack": Slack, "smtp": STMP, "stackfield": Stackfield, diff --git a/src/languages/cs-CZ.js b/src/languages/cs-CZ.js index b2b9331a4..c71075be7 100644 --- a/src/languages/cs-CZ.js +++ b/src/languages/cs-CZ.js @@ -576,4 +576,7 @@ export default { "Then choose an action, for example switch the scene to where an RGB light is red.": "Následně vyberte akci, například přepnutí scény z RGB světla na červenou.", "Frontend Version": "Verze frontendu", "Frontend Version do not match backend version!": "Verze frontendu neodpovídá verzi backendu!", + "You can divide numbers with": "Čísla můžete rozdělit pomocí ", + "or": "nebo", + "Gateway Type": "Typ brány", };