mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-24 10:26:02 +03:00
Merge pull request #2089 from jakubenglicky/smsmanager
feat: Add support notification via SMSManager
This commit is contained in:
commit
f96bad1629
6 changed files with 64 additions and 1 deletions
|
@ -22,7 +22,7 @@ class GoAlert extends NotificationProvider {
|
|||
let config = {
|
||||
headers: headers
|
||||
};
|
||||
let resp = await axios.post(`${notification.goAlertBaseURL}/api/v2/generic/incoming?token=${notification.goAlertToken}`, data, config);
|
||||
await axios.post(`${notification.goAlertBaseURL}/api/v2/generic/incoming?token=${notification.goAlertToken}`, data, config);
|
||||
return okMsg;
|
||||
|
||||
} catch (error) {
|
||||
|
|
25
server/notification-providers/smsmanager.js
Normal file
25
server/notification-providers/smsmanager.js
Normal file
|
@ -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;
|
|
@ -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(),
|
||||
|
|
31
src/components/notifications/SMSManager.vue
Normal file
31
src/components/notifications/SMSManager.vue
Normal file
|
@ -0,0 +1,31 @@
|
|||
<template>
|
||||
<div class="mb-3">
|
||||
<label for="smsmanager-key" class="form-label">API Key</label>
|
||||
<div class="form-text">
|
||||
{{ $t("SMSManager API Docs ") }}
|
||||
<a href="https://smsmanager.cz/api/http#send" target="_blank">{{ $t("here") }}</a>
|
||||
</div>
|
||||
<input id="smsmanager-key" v-model="$parent.notification.smsmanagerApiKey" type="text" class="form-control">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="smsmanager-numbers" class="form-label"> {{ $t("Recipients") }}</label>
|
||||
<div class="form-text">
|
||||
{{ $t("You can divide numbers with") }} <b>,</b> {{ $t("or") }} <b>;</b>
|
||||
</div>
|
||||
<input id="smsmanager-numbers" v-model="$parent.notification.numbers" type="text" class="form-control">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="smsmanager-messageType" class="form-label">{{ $t("Gateway Type") }}</label>
|
||||
<select id="smsmanager-messageType" v-model="$parent.notification.messageType" class="form-select">
|
||||
<option value="economy">Economy</option>
|
||||
<option value="lowcost">Lowcost</option>
|
||||
<option value="high" selected>High</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<div class="form-text">
|
||||
{{ $t("checkPrice", [$t("SMSManager")]) }}
|
||||
<a href="https://smsmanager.cz/rozesilani-sms/ceny/ceska-republika/" target="_blank">{{ $t("here") }}</a>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
|
@ -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,
|
||||
|
|
|
@ -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",
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue