This commit is contained in:
John Huseinovic 2026-01-20 06:03:21 +00:00 committed by GitHub
commit 3200121d23
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 109 additions and 0 deletions

View File

@ -0,0 +1,51 @@
const NotificationProvider = require("./notification-provider");
const axios = require("axios");
class MobivateSMS extends NotificationProvider {
name = "MobivateSMS";
/**
* @inheritdoc
*/
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
const okMsg = "Sent Successfully.";
const url = "https://vortex.mobivatebulksms.com/send/batch";
try {
// smspartner does not support non ascii characters and only a maximum 639 characters
let cleanMsg = msg.replace(/[^\x00-\x7F]/g, "").substring(0, 639);
let data = {
originator: notification.mobivateOriginator.substring(0, 15),
recipients: notification.mobivateRecipients
.split(",")
.map((n) => n.replace(/[^0-9]/g, ""))
.filter((n) => n.length >= 9)
.map((recipient) => ({ recipient })),
text: cleanMsg,
};
let config = {
headers: {
"Content-Type": "application/json",
"cache-control": "no-cache",
Accept: "application/json",
Authorization: "Bearer " + notification.mobivateApikey,
},
};
config = this.getAxiosConfigWithProxy(config);
let resp = await axios.post(url, data, config);
if (resp.data.success !== true) {
throw Error(`Api returned ${resp.data.response.status}.`);
}
return okMsg;
} catch (error) {
this.throwGeneralAxiosError(error);
}
}
}
module.exports = MobivateSMS;

View File

@ -28,6 +28,7 @@ const Line = require("./notification-providers/line");
const LunaSea = require("./notification-providers/lunasea"); const LunaSea = require("./notification-providers/lunasea");
const Matrix = require("./notification-providers/matrix"); const Matrix = require("./notification-providers/matrix");
const Mattermost = require("./notification-providers/mattermost"); const Mattermost = require("./notification-providers/mattermost");
const MobivateSMS = require("./notification-providers/mobivatesms");
const NextcloudTalk = require("./notification-providers/nextcloudtalk"); const NextcloudTalk = require("./notification-providers/nextcloudtalk");
const Nostr = require("./notification-providers/nostr"); const Nostr = require("./notification-providers/nostr");
const Ntfy = require("./notification-providers/ntfy"); const Ntfy = require("./notification-providers/ntfy");
@ -128,6 +129,7 @@ class Notification {
new LunaSea(), new LunaSea(),
new Matrix(), new Matrix(),
new Mattermost(), new Mattermost(),
new MobivateSMS(),
new NextcloudTalk(), new NextcloudTalk(),
new Nostr(), new Nostr(),
new Ntfy(), new Ntfy(),

View File

@ -267,6 +267,7 @@ export default {
Elks: "46elks", Elks: "46elks",
Cellsynt: "Cellsynt", Cellsynt: "Cellsynt",
gtxmessaging: "GtxMessaging", gtxmessaging: "GtxMessaging",
MobivateSMS: "Mobivate SMS",
octopush: "Octopush", octopush: "Octopush",
Onesender: "Onesender", Onesender: "Onesender",
SevenIO: "SevenIO", SevenIO: "SevenIO",

View File

@ -0,0 +1,53 @@
<template>
<div class="mb-3">
<label for="mobivate-key" class="form-label">
{{ $t("API Key") }}
<span style="color: red"><sup>*</sup></span>
</label>
<HiddenInput
id="mobivate-key"
v-model="$parent.notification.mobivateApikey"
:required="true"
autocomplete="new-password"
></HiddenInput>
</div>
<div class="mb-3">
<label for="mobivate-recipients" class="form-label">{{ $t("Recipients") }}</label>
<input
id="mobivate-recipients"
v-model="$parent.notification.mobivateRecipients"
type="text"
minlength="3"
maxlength="20"
pattern="^[\d+,]+$"
class="form-control"
required
/>
<div class="form-text">
<p>{{ $t("Comma separated list of numbers in international format. (eg. 447930000000,447930000001)") }}</p>
</div>
</div>
<div class="mb-3">
<label for="mobivate-originator" class="form-label">{{ $t("Originator") }}</label>
<input
id="mobivate-originator"
v-model="$parent.notification.mobivateOriginator"
type="text"
minlength="3"
maxlength="15"
pattern="^[a-zA-Z0-9]*$"
class="form-control"
required
/>
</div>
</template>
<script>
import HiddenInput from "../HiddenInput.vue";
export default {
components: {
HiddenInput,
},
};
</script>

View File

@ -27,6 +27,7 @@ import Line from "./Line.vue";
import LunaSea from "./LunaSea.vue"; import LunaSea from "./LunaSea.vue";
import Matrix from "./Matrix.vue"; import Matrix from "./Matrix.vue";
import Mattermost from "./Mattermost.vue"; import Mattermost from "./Mattermost.vue";
import MobivateSMS from "./MobivateSMS.vue";
import NextcloudTalk from "./NextcloudTalk.vue"; import NextcloudTalk from "./NextcloudTalk.vue";
import Nostr from "./Nostr.vue"; import Nostr from "./Nostr.vue";
import Ntfy from "./Ntfy.vue"; import Ntfy from "./Ntfy.vue";
@ -116,6 +117,7 @@ const NotificationFormList = {
lunasea: LunaSea, lunasea: LunaSea,
matrix: Matrix, matrix: Matrix,
mattermost: Mattermost, mattermost: Mattermost,
MobivateSMS: MobivateSMS,
nextcloudtalk: NextcloudTalk, nextcloudtalk: NextcloudTalk,
nostr: Nostr, nostr: Nostr,
ntfy: Ntfy, ntfy: Ntfy,