diff --git a/server/notification-providers/cellsynt.js b/server/notification-providers/cellsynt.js new file mode 100644 index 000000000..e842237b6 --- /dev/null +++ b/server/notification-providers/cellsynt.js @@ -0,0 +1,39 @@ +const NotificationProvider = require("./notification-provider"); +const axios = require("axios"); + +class Cellsynt extends NotificationProvider { + name = "Cellsynt"; + + /** + * @inheritdoc + */ + async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { + const okMsg = "Sent Successfully."; + const data = { + // docs at https://www.cellsynt.com/en/sms/api-integration + params: { + "username": notification.cellsyntLogin, + "password": notification.cellsyntPassword, + "destination": notification.cellsyntDestination, + "text": msg.replace(/[^\x00-\x7F]/g, ""), + "originatortype": notification.cellsyntOriginatortype, + "originator": notification.cellsyntOriginator, + "allowconcat": notification.cellsyntAllowLongSMS ? 6 : 1 + } + }; + try { + const resp = await axios.post("https://se-1.cellsynt.net/sms.php", null, data); + if (resp.data == null ) { + throw new Error("Could not connect to Cellsynt, please try again."); + } else if (resp.data.includes("Error:")) { + resp.data = resp.data.replaceAll("Error:", ""); + throw new Error(resp.data); + } + return okMsg; + } catch (error) { + this.throwGeneralAxiosError(error); + } + } +} + +module.exports = Cellsynt; diff --git a/server/notification.js b/server/notification.js index 29867019c..1d847104e 100644 --- a/server/notification.js +++ b/server/notification.js @@ -56,6 +56,7 @@ const SMSManager = require("./notification-providers/smsmanager"); const ServerChan = require("./notification-providers/serverchan"); const ZohoCliq = require("./notification-providers/zoho-cliq"); const GtxMessaging = require("./notification-providers/gtx-messaging"); +const Cellsynt = require("./notification-providers/cellsynt"); class Notification { @@ -129,6 +130,7 @@ class Notification { new GoAlert(), new ZohoCliq(), new GtxMessaging(), + new Cellsynt(), ]; for (let item of list) { if (! item.name) { diff --git a/src/components/NotificationDialog.vue b/src/components/NotificationDialog.vue index 12209f33f..3e7569453 100644 --- a/src/components/NotificationDialog.vue +++ b/src/components/NotificationDialog.vue @@ -153,7 +153,8 @@ export default { "webhook": "Webhook", "GoAlert": "GoAlert", "ZohoCliq": "ZohoCliq", - "gtxmessaging": "GtxMessaging" + "gtxmessaging": "GtxMessaging", + "Cellsynt": "Cellsynt" }; // Put notifications here if it's not supported in most regions or its documentation is not in English diff --git a/src/components/notifications/Cellsynt.vue b/src/components/notifications/Cellsynt.vue new file mode 100644 index 000000000..2e8a6de71 --- /dev/null +++ b/src/components/notifications/Cellsynt.vue @@ -0,0 +1,54 @@ + + + diff --git a/src/components/notifications/index.js b/src/components/notifications/index.js index f9e6eb8fa..b422c4938 100644 --- a/src/components/notifications/index.js +++ b/src/components/notifications/index.js @@ -54,6 +54,7 @@ import WeCom from "./WeCom.vue"; import GoAlert from "./GoAlert.vue"; import ZohoCliq from "./ZohoCliq.vue"; import Splunk from "./Splunk.vue"; +import Cellsynt from "./Cellsynt.vue"; /** * Manage all notification form. @@ -116,6 +117,7 @@ const NotificationFormList = { "ServerChan": ServerChan, "ZohoCliq": ZohoCliq, "gtxmessaging": GtxMessaging, + "Cellsynt": Cellsynt, }; export default NotificationFormList; diff --git a/src/lang/en.json b/src/lang/en.json index b406f67c5..9a44b2cdf 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -892,5 +892,18 @@ "From Phone Number / Transmission Path Originating Address (TPOA)": "From Phone Number / Transmission Path Originating Address (TPOA)", "gtxMessagingFromHint": "On mobile phones, your recipients sees the TPOA displayed as the sender of the message. Allowed are up to 11 alphanumeric characters, a shortcode, the local longcode or international numbers ({e164}, {e212} or {e214})", "To Phone Number": "To Phone Number", - "gtxMessagingToHint": "International format, with leading \"+\" ({e164}, {e212} or {e214})" + "gtxMessagingToHint": "International format, with leading \"+\" ({e164}, {e212} or {e214})", + "Originator type": "Originator type", + "Alphanumeric (recommended)": "Alphanumeric (recommended)", + "Telephone number": "Telephone number", + "cellsyntOriginatortypeAlphanumeric": "Alphanumeric string (max 11 alphanumeric characters). Recipients can not reply to the message.", + "cellsyntOriginatortypeNumeric": "Numeric value (max 15 digits) with telephone number on international format without leading 00 (example UK number 07920 110 000 should be set as 447920110000). Recipients can reply to the message.", + "Originator": "Originator", + "cellsyntOriginator": "Visible on recipient's mobile phone as originator of the message. Allowed values and function depends on parameter originatortype.", + "Destination": "Destination", + "cellsyntDestination": "Recipient's telephone number using international format with leading 00 followed by country code, e.g. 00447920110000 for the UK number 07920 110 000 (max 17 digits in total). Max 25000 comma separated recipients per HTTP request.", + "Allow Long SMS": "Allow Long SMS", + "cellsyntSplitLongMessages": "Split long messages into up to 6 parts. 153 x 6 = 918 characters.", + "max 15 digits": "max 15 digits", + "max 11 alphanumeric characters": "max 11 alphanumeric characters" }