Click send sms integration for notifications

This commit is contained in:
Tarun Singh 2021-10-24 15:17:29 -04:00
parent 8a481a1be0
commit bc68088350
29 changed files with 394 additions and 286 deletions

View file

@ -0,0 +1,43 @@
const NotificationProvider = require("./notification-provider");
const axios = require("axios");
class ClickSendSMS extends NotificationProvider {
name = "clicksendsms";
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully.";
try {
console.log({ notification });
let config = {
headers: {
"Content-Type": "application/json",
"Authorization": "Basic " + Buffer.from(notification.clicksendsmsLogin + ":" + notification.clicksendsmsPassword).toString('base64'),
"Accept": "text/json",
}
};
let data = {
messages: [
{
"body": msg.replace(/[^\x00-\x7F]/g, ""),
// TODO: To phone number concept to be added
"to": "+61411111111",
"source": "uptime-kuma",
"from": notification.clicksendsmsSenderName,
}
]
};
let resp = await axios.post("https://rest.clicksend.com/v3/sms/send", data, config);
if (resp.data.http_code !== 200) {
let error = "Something gone wrong. Api returned " + resp.data.response.status + ".";
this.throwGeneralAxiosError(error);
}
return okMsg;
} catch (error) {
this.throwGeneralAxiosError(error);
}
}
}
module.exports = ClickSendSMS;

View file

@ -8,6 +8,7 @@ const Mattermost = require("./notification-providers/mattermost");
const Matrix = require("./notification-providers/matrix"); const Matrix = require("./notification-providers/matrix");
const Octopush = require("./notification-providers/octopush"); const Octopush = require("./notification-providers/octopush");
const PromoSMS = require("./notification-providers/promosms"); const PromoSMS = require("./notification-providers/promosms");
const ClickSendSMS = require("./notification-providers/clicksendsms");
const Pushbullet = require("./notification-providers/pushbullet"); const Pushbullet = require("./notification-providers/pushbullet");
const Pushover = require("./notification-providers/pushover"); const Pushover = require("./notification-providers/pushover");
const Pushy = require("./notification-providers/pushy"); const Pushy = require("./notification-providers/pushy");
@ -45,6 +46,7 @@ class Notification {
new Matrix(), new Matrix(),
new Octopush(), new Octopush(),
new PromoSMS(), new PromoSMS(),
new ClickSendSMS(),
new Pushbullet(), new Pushbullet(),
new Pushover(), new Pushover(),
new Pushy(), new Pushy(),

View file

@ -0,0 +1,35 @@
<template>
<div class="mb-3">
<label for="clicksendsms-login" class="form-label">API Username</label>
<div class="form-text">
{{ $t("apiCredentials") }}
<a href="http://dashboard.clicksend.com/account/subaccounts" target="_blank">here</a>
</div>
<input id="clicksendsms-login" v-model="$parent.notification.clicksendsmsLogin" type="text" class="form-control" required>
<label for="clicksendsms-key" class="form-label">API Key</label>
<HiddenInput id="clicksendsms-key" v-model="$parent.notification.clicksendsmsPassword" :required="true" autocomplete="one-time-code"></HiddenInput>
</div>
<div class="mb-3">
<div class="form-text">
{{ $t("checkPrice", [$t("clicksendsms")]) }}
<a href="https://www.clicksend.com/us/pricing" target="_blank">here</a>
</div>
</div>
<div class="mb-3">
<label for="clicksendsms-sender-name" class="form-label">From Name/Number -
<a href="https://help.clicksend.com/article/4kgj7krx00-what-is-a-sender-id-or-sender-number" target="_blank">More Info</a>
</label>
<input id="clicksendsms-sender-name" v-model="$parent.notification.clicksendsmsSenderName" type="text" minlength="3" maxlength="11" class="form-control">
<div class="form-text">Leave blank to use a shared sender number.</div>
</div>
</template>
<script>
import HiddenInput from "../HiddenInput.vue";
export default {
components: {
HiddenInput,
},
};
</script>

View file

@ -11,6 +11,7 @@ import Pushover from "./Pushover.vue";
import Pushy from "./Pushy.vue"; import Pushy from "./Pushy.vue";
import Octopush from "./Octopush.vue"; import Octopush from "./Octopush.vue";
import PromoSMS from "./PromoSMS.vue"; import PromoSMS from "./PromoSMS.vue";
import ClickSendSMS from "./ClickSendSMS.vue";
import LunaSea from "./LunaSea.vue"; import LunaSea from "./LunaSea.vue";
import Feishu from "./Feishu.vue"; import Feishu from "./Feishu.vue";
import Apprise from "./Apprise.vue"; import Apprise from "./Apprise.vue";
@ -40,6 +41,7 @@ const NotificationFormList = {
"pushy": Pushy, "pushy": Pushy,
"octopush": Octopush, "octopush": Octopush,
"promosms": PromoSMS, "promosms": PromoSMS,
"clicksendsms": ClickSendSMS,
"lunasea": LunaSea, "lunasea": LunaSea,
"Feishu": Feishu, "Feishu": Feishu,
"AliyunSMS": AliyunSMS, "AliyunSMS": AliyunSMS,

View file

@ -191,6 +191,7 @@ export default {
pushy: "Pushy", pushy: "Pushy",
octopush: "Octopush", octopush: "Octopush",
promosms: "PromoSMS", promosms: "PromoSMS",
clicksendsms: "ClickSend SMS",
lunasea: "LunaSea", lunasea: "LunaSea",
apprise: "Apprise (Поддържа 50+ услуги за инвестяване)", apprise: "Apprise (Поддържа 50+ услуги за инвестяване)",
pushbullet: "Pushbullet", pushbullet: "Pushbullet",

View file

@ -193,6 +193,7 @@ export default {
pushy: "Pushy", pushy: "Pushy",
octopush: "Octopush", octopush: "Octopush",
promosms: "PromoSMS", promosms: "PromoSMS",
clicksendsms: "ClickSend SMS",
lunasea: "LunaSea", lunasea: "LunaSea",
apprise: "Apprise (Support 50+ Notification services)", apprise: "Apprise (Support 50+ Notification services)",
pushbullet: "Pushbullet", pushbullet: "Pushbullet",

View file

@ -192,6 +192,7 @@ export default {
pushy: "Pushy", pushy: "Pushy",
octopush: "Octopush", octopush: "Octopush",
promosms: "PromoSMS", promosms: "PromoSMS",
clicksendsms: "ClickSend SMS",
lunasea: "LunaSea", lunasea: "LunaSea",
apprise: "Apprise (Unterstützung für 50+ Benachrichtigungsdienste)", apprise: "Apprise (Unterstützung für 50+ Benachrichtigungsdienste)",
pushbullet: "Pushbullet", pushbullet: "Pushbullet",

View file

@ -241,6 +241,7 @@ export default {
pushy: "Pushy", pushy: "Pushy",
octopush: "Octopush", octopush: "Octopush",
promosms: "PromoSMS", promosms: "PromoSMS",
clicksendsms: "ClickSend SMS",
lunasea: "LunaSea", lunasea: "LunaSea",
apprise: "Apprise (Support 50+ Notification services)", apprise: "Apprise (Support 50+ Notification services)",
pushbullet: "Pushbullet", pushbullet: "Pushbullet",
@ -257,6 +258,7 @@ export default {
octopushTypePremium: "Premium (Fast - recommended for alerting)", octopushTypePremium: "Premium (Fast - recommended for alerting)",
octopushTypeLowCost: "Low Cost (Slow - sometimes blocked by operator)", octopushTypeLowCost: "Low Cost (Slow - sometimes blocked by operator)",
checkPrice: "Check {0} prices:", checkPrice: "Check {0} prices:",
apiCredentials: "API credentials",
octopushLegacyHint: "Do you use the legacy version of Octopush (2011-2020) or the new version?", octopushLegacyHint: "Do you use the legacy version of Octopush (2011-2020) or the new version?",
"Check octopush prices": "Check octopush prices {0}.", "Check octopush prices": "Check octopush prices {0}.",
octopushPhoneNumber: "Phone number (intl format, eg : +33612345678) ", octopushPhoneNumber: "Phone number (intl format, eg : +33612345678) ",

View file

@ -193,6 +193,7 @@ export default {
pushy: "Pushy", pushy: "Pushy",
octopush: "Octopush", octopush: "Octopush",
promosms: "PromoSMS", promosms: "PromoSMS",
clicksendsms: "ClickSend SMS",
lunasea: "LunaSea", lunasea: "LunaSea",
apprise: "Apprise (Admite más de 50 servicios de notificación)", apprise: "Apprise (Admite más de 50 servicios de notificación)",
pushbullet: "Pushbullet", pushbullet: "Pushbullet",

View file

@ -192,6 +192,7 @@ export default {
pushy: "Pushy", pushy: "Pushy",
octopush: "Octopush", octopush: "Octopush",
promosms: "PromoSMS", promosms: "PromoSMS",
clicksendsms: "ClickSend SMS",
lunasea: "LunaSea", lunasea: "LunaSea",
apprise: "Apprise (vahendab üle 65 teavitusteenust)", apprise: "Apprise (vahendab üle 65 teavitusteenust)",
pushbullet: "Pushbullet", pushbullet: "Pushbullet",

View file

@ -200,6 +200,7 @@ export default {
pushy: "Pushy", pushy: "Pushy",
octopush: "Octopush", octopush: "Octopush",
promosms: "PromoSMS", promosms: "PromoSMS",
clicksendsms: "ClickSend SMS",
lunasea: "LunaSea", lunasea: "LunaSea",
apprise: "Apprise (Support 50+ Notification services)", apprise: "Apprise (Support 50+ Notification services)",
pushbullet: "Pushbullet", pushbullet: "Pushbullet",

View file

@ -236,6 +236,7 @@ export default {
pushy: "Pushy", pushy: "Pushy",
octopush: "Octopush", octopush: "Octopush",
promosms: "PromoSMS", promosms: "PromoSMS",
clicksendsms: "ClickSend SMS",
lunasea: "LunaSea", lunasea: "LunaSea",
apprise: "Apprise (Support 50+ Notification services)", apprise: "Apprise (Support 50+ Notification services)",
pushbullet: "Pushbullet", pushbullet: "Pushbullet",

View file

@ -191,6 +191,7 @@ export default {
pushy: "Pushy", pushy: "Pushy",
octopush: "Octopush", octopush: "Octopush",
promosms: "PromoSMS", promosms: "PromoSMS",
clicksendsms: "ClickSend SMS",
lunasea: "LunaSea", lunasea: "LunaSea",
apprise: "Apprise (Support 50+ Notification services)", apprise: "Apprise (Support 50+ Notification services)",
pushbullet: "Pushbullet", pushbullet: "Pushbullet",

View file

@ -236,6 +236,7 @@ export default {
pushy: "Pushy", pushy: "Pushy",
octopush: "Octopush", octopush: "Octopush",
promosms: "PromoSMS", promosms: "PromoSMS",
clicksendsms: "ClickSend SMS",
lunasea: "LunaSea", lunasea: "LunaSea",
apprise: "Apprise (Mendukung 50+ layanan notifikasi)", apprise: "Apprise (Mendukung 50+ layanan notifikasi)",
pushbullet: "Pushbullet", pushbullet: "Pushbullet",

View file

@ -192,6 +192,7 @@ export default {
pushy: "Pushy", pushy: "Pushy",
octopush: "Octopush", octopush: "Octopush",
promosms: "PromoSMS", promosms: "PromoSMS",
clicksendsms: "ClickSend SMS",
lunasea: "LunaSea", lunasea: "LunaSea",
apprise: "Apprise (Support 50+ Notification services)", apprise: "Apprise (Support 50+ Notification services)",
pushbullet: "Pushbullet", pushbullet: "Pushbullet",

View file

@ -193,6 +193,7 @@ export default {
pushy: "Pushy", pushy: "Pushy",
octopush: "Octopush", octopush: "Octopush",
promosms: "PromoSMS", promosms: "PromoSMS",
clicksendsms: "ClickSend SMS",
lunasea: "LunaSea", lunasea: "LunaSea",
apprise: "Apprise (Support 50+ Notification services)", apprise: "Apprise (Support 50+ Notification services)",
pushbullet: "Pushbullet", pushbullet: "Pushbullet",

View file

@ -235,6 +235,7 @@ export default {
pushy: "Pushy", pushy: "Pushy",
octopush: "Octopush", octopush: "Octopush",
promosms: "PromoSMS", promosms: "PromoSMS",
clicksendsms: "ClickSend SMS",
lunasea: "LunaSea", lunasea: "LunaSea",
apprise: "Apprise (50개 이상 알림 서비스)", apprise: "Apprise (50개 이상 알림 서비스)",
pushbullet: "Pushbullet", pushbullet: "Pushbullet",

View file

@ -236,6 +236,7 @@ export default {
pushy: "Pushy", pushy: "Pushy",
octopush: "Octopush", octopush: "Octopush",
promosms: "PromoSMS", promosms: "PromoSMS",
clicksendsms: "ClickSend SMS",
lunasea: "LunaSea", lunasea: "LunaSea",
apprise: "Apprise (Support 50+ Notification services)", apprise: "Apprise (Support 50+ Notification services)",
pushbullet: "Pushbullet", pushbullet: "Pushbullet",

View file

@ -193,6 +193,7 @@ export default {
pushy: "Pushy", pushy: "Pushy",
octopush: "Octopush", octopush: "Octopush",
promosms: "PromoSMS", promosms: "PromoSMS",
clicksendsms: "ClickSend SMS",
lunasea: "LunaSea", lunasea: "LunaSea",
apprise: "Apprise (Support 50+ Notification services)", apprise: "Apprise (Support 50+ Notification services)",
pushbullet: "Pushbullet", pushbullet: "Pushbullet",
@ -203,5 +204,5 @@ export default {
Headers: "Headers", Headers: "Headers",
PushUrl: "Push URL", PushUrl: "Push URL",
HeadersInvalidFormat: "The request headers is geen geldige JSON: ", HeadersInvalidFormat: "The request headers is geen geldige JSON: ",
BodyInvalidFormat: "De request body is geen geldige JSON: " BodyInvalidFormat: "De request body is geen geldige JSON: ",
}; };

View file

@ -236,6 +236,7 @@ export default {
pushy: "Pushy", pushy: "Pushy",
octopush: "Octopush", octopush: "Octopush",
promosms: "PromoSMS", promosms: "PromoSMS",
clicksendsms: "ClickSend SMS",
lunasea: "LunaSea", lunasea: "LunaSea",
apprise: "Apprise (Obsługuje 50+ usług powiadomień)", apprise: "Apprise (Obsługuje 50+ usług powiadomień)",
pushbullet: "Pushbullet", pushbullet: "Pushbullet",

View file

@ -192,6 +192,7 @@ export default {
pushy: "Pushy", pushy: "Pushy",
octopush: "Octopush", octopush: "Octopush",
promosms: "PromoSMS", promosms: "PromoSMS",
clicksendsms: "ClickSend SMS",
lunasea: "LunaSea", lunasea: "LunaSea",
apprise: "Apprise (Support 50+ Notification services)", apprise: "Apprise (Support 50+ Notification services)",
pushbullet: "Pushbullet", pushbullet: "Pushbullet",

View file

@ -197,6 +197,7 @@ export default {
pushy: "Pushy", pushy: "Pushy",
octopush: "Octopush", octopush: "Octopush",
promosms: "PromoSMS", promosms: "PromoSMS",
clicksendsms: "ClickSend SMS",
lunasea: "LunaSea", lunasea: "LunaSea",
apprise: "Apprise (Поддержка 50+ сервисов уведомлений)", apprise: "Apprise (Поддержка 50+ сервисов уведомлений)",
pushbullet: "Pushbullet", pushbullet: "Pushbullet",

View file

@ -193,6 +193,7 @@ export default {
pushy: "Pushy", pushy: "Pushy",
octopush: "Octopush", octopush: "Octopush",
promosms: "PromoSMS", promosms: "PromoSMS",
clicksendsms: "ClickSend SMS",
lunasea: "LunaSea", lunasea: "LunaSea",
apprise: "Apprise (Support 50+ Notification services)", apprise: "Apprise (Support 50+ Notification services)",
pushbullet: "Pushbullet", pushbullet: "Pushbullet",

View file

@ -193,6 +193,7 @@ export default {
pushy: "Pushy", pushy: "Pushy",
octopush: "Octopush", octopush: "Octopush",
promosms: "PromoSMS", promosms: "PromoSMS",
clicksendsms: "ClickSend SMS",
lunasea: "LunaSea", lunasea: "LunaSea",
apprise: "Apprise (Support 50+ Notification services)", apprise: "Apprise (Support 50+ Notification services)",
pushbullet: "Pushbullet", pushbullet: "Pushbullet",

View file

@ -193,6 +193,7 @@ export default {
pushy: "Pushy", pushy: "Pushy",
octopush: "Octopush", octopush: "Octopush",
promosms: "PromoSMS", promosms: "PromoSMS",
clicksendsms: "ClickSend SMS",
lunasea: "LunaSea", lunasea: "LunaSea",
apprise: "Apprise (Support 50+ Notification services)", apprise: "Apprise (Support 50+ Notification services)",
pushbullet: "Pushbullet", pushbullet: "Pushbullet",

View file

@ -192,6 +192,7 @@ export default {
pushy: "Pushy", pushy: "Pushy",
octopush: "Octopush", octopush: "Octopush",
promosms: "PromoSMS", promosms: "PromoSMS",
clicksendsms: "ClickSend SMS",
lunasea: "LunaSea", lunasea: "LunaSea",
apprise: "Apprise (Support 50+ Notification services)", apprise: "Apprise (Support 50+ Notification services)",
pushbullet: "Pushbullet", pushbullet: "Pushbullet",

View file

@ -236,6 +236,7 @@ export default {
pushy: "Pushy", pushy: "Pushy",
octopush: "Octopush", octopush: "Octopush",
promosms: "PromoSMS", promosms: "PromoSMS",
clicksendsms: "ClickSend SMS",
lunasea: "LunaSea", lunasea: "LunaSea",
apprise: "Thông báo (Hỗ trợ 50+ dịch vụ thông báo)", apprise: "Thông báo (Hỗ trợ 50+ dịch vụ thông báo)",
pushbullet: "Pushbullet", pushbullet: "Pushbullet",

View file

@ -197,6 +197,7 @@ export default {
pushy: "Pushy", pushy: "Pushy",
octopush: "Octopush", octopush: "Octopush",
promosms: "PromoSMS", promosms: "PromoSMS",
clicksendsms: "ClickSend SMS",
lunasea: "LunaSea", lunasea: "LunaSea",
apprise: "Apprise (支持50+种通知服务)", apprise: "Apprise (支持50+种通知服务)",
pushbullet: "Pushbullet", pushbullet: "Pushbullet",

View file

@ -193,6 +193,7 @@ export default {
pushy: "Pushy", pushy: "Pushy",
octopush: "Octopush", octopush: "Octopush",
promosms: "PromoSMS", promosms: "PromoSMS",
clicksendsms: "ClickSend SMS",
lunasea: "LunaSea", lunasea: "LunaSea",
apprise: "Apprise (支援 50 多種通知)", apprise: "Apprise (支援 50 多種通知)",
pushbullet: "Pushbullet", pushbullet: "Pushbullet",