notification provider now added and tested

pull/4625/head
Simon Nilsson 8 months ago
parent 90489752aa
commit b908a3f797

@ -0,0 +1,118 @@
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.";
let data = {
params: {
/* Your username (received when account is setup).
*/
"username": notification.cellsyntLogin,
/* Your password to use together with the username for
authentication (received when account is setup).
*/
"password": notification.cellsyntPassword,
/* Recipient's telephone number on international format with
leading 00 followed by country code, e.g. 00447920110000 for
UK number 07920 110 000 (max 17 digits in total).
To send the same message to multiple recipients, separate
numbers with comma. Max 25000 recipients per HTTP request.
*/
"destination": notification.cellsyntDestination,
"text": msg.replace(/[^\x00-\x7F]/g, ""),
/* Character set text and other data is sent as in the HTTP
request. Possible values: ISO-8859-1 (default) and UTF-8
*/
"charset": "UTF-8",
/* Controls the originator type the message should be sent with.
Possible values: numeric, shortcode and alpha.
*/
"originatortype": notification.cellsyntOriginatortype,
/* Identifier which will be visible on recipient's mobile phone as
originator of the message. Allowed values and function depends
on parameter originatortype's value according to below:
** alpha **
3Send SMS
Alphanumeric string (max 11 characters). The following
characters are guaranteed to work: a-z, A-Z and 0-9. Other
characters may work but functionality can not be guaranteed.
Recipients can not reply to messages with alphanumeric
originators
** numeric **
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). Receiving
mobile phone will add a leading + sign and thus see the
originator as a normal mobile phone number (+447920110000).
Therefore it is also possible to reply to the message.
*/
//"originator": "uptime-kuma",
"originator": notification.cellsyntOriginator,
/* Type of message that should be sent. Possible values: text
(default), binary and unicode */
//"type": "text",
/* Maximum number of SMS permitted to be linked together when
needed (default value is 1, see Long SMS). Maximum value is 6
(i.e. max 153 x 6 = 918 characters).
*/
"allowconcat": notification.cellsyntAllowLongSMS ? 6 : 1,
/* Value can be set to true if message should be sent as "flash
message", i.e. displayed directly on phone screen instead of
being saved to inbox. This is identical to setting class=0.
Please note that support for flash messages cannot be
guaranteed to all operator networks. If flash is not supported the
message will be sent as a regular text message instead
(class=1).
*/
//"flash": "",
/* Message class can be set to 0 (flash message), 1 (default, MEspecific), 2 (SIM-specific) or 3 (TE-specific).
*/
//"class": "",
/* UDH (User Data Header) can be used to send concatenated
SMS, contain formatting information, convey port numbers as a
mean to cause start of an application etc. The value should be
given on hexadecimal format for the corresponding bytes you
wish to send (e.g. AABBCC).
*/
//"udh": "",
/* Protocol Identifier (specified in GSM 03.40) says how the
message should be interpreted. Value should be given on
hexadecimal format, e.g. 00 for a regular message and 7D
(decimal 125) for a configuration message ("ME Data
download").
*/
//"pid": "",
}
};
try {
if (heartbeatJSON != null) {
data.params.text = msg.replace(/[^\x00-\x7F]/g, "");
}
const resp = await axios.post("https://se-1.cellsynt.net/sms.php", null, data);
if (resp.data == null || resp.data.includes("Error")) {
throw new Error(resp.data);
}else{
return okMsg;
}
} catch (error) {
this.throwGeneralAxiosError(error);
}
}
}
module.exports = Cellsynt;

@ -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) {

@ -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

@ -0,0 +1,54 @@
<template>
<div class="mb-3">
<label for="cellsynt-login" class="form-label">{{ $t("Username") }}</label>
<input id="cellsynt-login" v-model="$parent.notification.cellsyntLogin" type="text" class="form-control" required>
</div>
<div class="mb-3">
<label for="cellsynt-key" class="form-label">{{ $t("Password") }}</label>
<HiddenInput id="cellsynt-key" v-model="$parent.notification.cellsyntPassword" :required="true" autocomplete="new-password"></HiddenInput>
</div>
<div class="mb-3">
<label for="cellsynt-Originatortype" class="form-label">{{ $t("Originator type") }}</label>
<select id="cellsynt-Originatortype" v-model="$parent.notification.cellsyntOriginatortype" :required="true" class="form-select">
<option value="alpha">{{ $t("Alpha (recommended)") }}</option>
<option value="numeric">{{ $t("Numeric") }}</option>
</select>
<div class="form-text">
<p><b>{{ $t("Alpha (recommended)") }}:</b><br /> {{ $t("Alphanumeric string (max 11 alphanumeric characters). Recipients can not reply to the message.") }}</p>
<p><b>{{ $t("Numeric") }}:</b><br /> {{ $t("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.") }}</p>
</div>
</div>
<div class="mb-3">
<label for="cellsynt-originator" class="form-label">{{ $t("Originator") }}</label>
<input id="cellsynt-originator" v-model="$parent.notification.cellsyntOriginator" type="text" class="form-control" required>
<div class="form-text"><p>{{ $t("Visible on recipient's mobile phone as originator of the message. Allowed values and function depends on parameter originatortype.") }}</p></div>
</div>
<div class="mb-3">
<label for="cellsynt-destination" class="form-label">{{ $t("Destination") }}</label>
<input id="cellsynt-destination" v-model="$parent.notification.cellsyntDestination" type="text" class="form-control" required>
<div class="form-text"><p>{{ $t("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.") }}</p></div>
</div>
<div class="form-check form-switch">
<input id="cellsynt-allow-long" v-model="$parent.notification.cellsyntAllowLongSMS" type="checkbox" class="form-check-input">
<label for="cellsynt-allow-long" class="form-label">{{ $t("Allow Long SMS") }}</label>
<div class="form-text">{{ $t("Split long messages into up to 6 parts. 153 x 6 = 918 characters.") }}</div>
</div>
<i18n-t tag="p" keypath="More info on:" style="margin-top: 8px;">
<a href="https://www.cellsynt.com/en/" target="_blank">https://www.cellsynt.com/en/</a>
</i18n-t>
</template>
<script>
import HiddenInput from "../HiddenInput.vue";
export default {
components: {
HiddenInput
},
mounted() {
this.$parent.notification.cellsyntOriginator = "uptime-kuma";
this.$parent.notification.cellsyntOriginatortype = "alpha";
console.log("hello world");
}
};
</script>

@ -54,6 +54,8 @@ 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 +118,7 @@ const NotificationFormList = {
"ServerChan": ServerChan,
"ZohoCliq": ZohoCliq,
"gtxmessaging": GtxMessaging,
"Cellsynt": Cellsynt
};
export default NotificationFormList;

@ -892,5 +892,16 @@
"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",
"Alpha (recommended)": "Alpha (recommended)",
"Numeric": "Numeric",
"Alphanumeric string (max 11 alphanumeric characters). Recipients can not reply to the message.": "Alphanumeric string (max 11 alphanumeric characters). Recipients can not reply to the message.",
"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.": "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",
"Visible on recipient's mobile phone as originator of the message. Allowed values and function depends on parameter originatortype.": "Visible on recipient's mobile phone as originator of the message. Allowed values and function depends on parameter originatortype.",
"Destination": "Destination",
"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.": "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",
"Split long messages into up to 6 parts. 153 x 6 = 918 characters.": "Split long messages into up to 6 parts. 153 x 6 = 918 characters."
}

Loading…
Cancel
Save