mirror of
https://github.com/louislam/uptime-kuma.git
synced 2026-08-07 09:14:58 +00:00
feat: add Plivo SMS notification provider (#7584)
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
const NotificationProvider = require("./notification-provider");
|
||||
const axios = require("axios");
|
||||
|
||||
class Plivo extends NotificationProvider {
|
||||
name = "plivo";
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
|
||||
const okMsg = "Sent Successfully.";
|
||||
|
||||
try {
|
||||
let config = {
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization:
|
||||
"Basic " +
|
||||
Buffer.from(notification.plivoAuthID + ":" + notification.plivoAuthToken).toString("base64"),
|
||||
},
|
||||
};
|
||||
config = this.getAxiosConfigWithProxy(config);
|
||||
|
||||
const data = {
|
||||
src: notification.plivoFromNumber,
|
||||
dst: notification.plivoToNumber,
|
||||
text: msg,
|
||||
};
|
||||
|
||||
await axios.post(`https://api.plivo.com/v1/Account/${notification.plivoAuthID}/Message/`, data, config);
|
||||
|
||||
return okMsg;
|
||||
} catch (error) {
|
||||
this.throwGeneralAxiosError(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Plivo;
|
||||
@@ -45,6 +45,7 @@ const Pumble = require("./notification-providers/pumble");
|
||||
const FlashDuty = require("./notification-providers/flashduty");
|
||||
const Flowtriq = require("./notification-providers/flowtriq");
|
||||
const PagerTree = require("./notification-providers/pagertree");
|
||||
const Plivo = require("./notification-providers/plivo");
|
||||
const PromoSMS = require("./notification-providers/promosms");
|
||||
const Pushbullet = require("./notification-providers/pushbullet");
|
||||
const PushDeer = require("./notification-providers/pushdeer");
|
||||
@@ -158,6 +159,7 @@ class Notification {
|
||||
new FlashDuty(),
|
||||
new Flowtriq(),
|
||||
new PagerTree(),
|
||||
new Plivo(),
|
||||
new PromoSMS(),
|
||||
new Pumble(),
|
||||
new Pushbullet(),
|
||||
|
||||
@@ -272,6 +272,7 @@ export default {
|
||||
gtxmessaging: "GtxMessaging",
|
||||
octopush: "Octopush",
|
||||
Onesender: "Onesender",
|
||||
plivo: "Plivo",
|
||||
SevenIO: "SevenIO",
|
||||
SMSEagle: "SMSEagle",
|
||||
SMSPartner: "SMS Partner",
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
<template>
|
||||
<div class="mb-3">
|
||||
<label for="plivo-auth-id" class="form-label">{{ $t("plivoAuthID") }}</label>
|
||||
<input
|
||||
id="plivo-auth-id"
|
||||
v-model="$parent.notification.plivoAuthID"
|
||||
type="text"
|
||||
class="form-control"
|
||||
required
|
||||
/>
|
||||
<div class="form-text">{{ $t("plivoAuthIDHelptext") }}</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="plivo-auth-token" class="form-label">{{ $t("plivoAuthToken") }}</label>
|
||||
<HiddenInput
|
||||
id="plivo-auth-token"
|
||||
v-model="$parent.notification.plivoAuthToken"
|
||||
:required="true"
|
||||
autocomplete="new-password"
|
||||
></HiddenInput>
|
||||
<div class="form-text">{{ $t("plivoAuthTokenHelptext") }}</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="plivo-from-number" class="form-label">{{ $t("plivoFromNumber") }}</label>
|
||||
<input
|
||||
id="plivo-from-number"
|
||||
v-model="$parent.notification.plivoFromNumber"
|
||||
type="text"
|
||||
class="form-control"
|
||||
placeholder="+15551234567"
|
||||
required
|
||||
/>
|
||||
<div class="form-text">{{ $t("plivoFromNumberHelptext") }}</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="plivo-to-number" class="form-label">{{ $t("plivoToNumber") }}</label>
|
||||
<input
|
||||
id="plivo-to-number"
|
||||
v-model="$parent.notification.plivoToNumber"
|
||||
type="text"
|
||||
class="form-control"
|
||||
placeholder="+15559876543"
|
||||
required
|
||||
/>
|
||||
<div class="form-text">{{ $t("plivoToNumberHelptext") }}</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<i18n-t tag="p" keypath="More info on:" style="margin-top: 8px">
|
||||
<a href="https://www.plivo.com/docs/messaging/api/message" target="_blank">
|
||||
https://www.plivo.com/docs/messaging/api/message
|
||||
</a>
|
||||
</i18n-t>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import HiddenInput from "../HiddenInput.vue";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
HiddenInput,
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -44,6 +44,7 @@ import PagerDuty from "./PagerDuty.vue";
|
||||
import FlashDuty from "./FlashDuty.vue";
|
||||
import Flowtriq from "./Flowtriq.vue";
|
||||
import PagerTree from "./PagerTree.vue";
|
||||
import Plivo from "./Plivo.vue";
|
||||
import PromoSMS from "./PromoSMS.vue";
|
||||
import Pumble from "./Pumble.vue";
|
||||
import Pushbullet from "./Pushbullet.vue";
|
||||
@@ -146,6 +147,7 @@ const NotificationFormList = {
|
||||
FlashDuty: FlashDuty,
|
||||
Flowtriq: Flowtriq,
|
||||
PagerTree: PagerTree,
|
||||
plivo: Plivo,
|
||||
promosms: PromoSMS,
|
||||
pumble: Pumble,
|
||||
pushbullet: Pushbullet,
|
||||
|
||||
@@ -1048,6 +1048,14 @@
|
||||
"telnyxToNumberHelptext": "The destination phone number to receive SMS notifications (e.g. +15559876543)",
|
||||
"telnyxMessagingProfileId": "Messaging Profile ID (optional)",
|
||||
"telnyxMessagingProfileIdHelptext": "Optionally associate a Telnyx Messaging Profile to control sender settings and features",
|
||||
"plivoAuthID": "Auth ID",
|
||||
"plivoAuthIDHelptext": "Your Plivo Auth ID from the Plivo Console",
|
||||
"plivoAuthToken": "Auth Token",
|
||||
"plivoAuthTokenHelptext": "Your Plivo Auth Token from the Plivo Console",
|
||||
"plivoFromNumber": "From Number",
|
||||
"plivoFromNumberHelptext": "The Plivo phone number or sender ID to send from (e.g. +15551234567)",
|
||||
"plivoToNumber": "To Number",
|
||||
"plivoToNumberHelptext": "The destination phone number to receive SMS notifications (e.g. +15559876543)",
|
||||
"twilioAccountSID": "Account SID",
|
||||
"twilioApiKey": "Api Key (optional)",
|
||||
"twilioApiKeyHelptext": "The API key is optional but recommended. You can provide either Account SID and AuthToken from the may TwilioConsole page or Account SID and the pair of Api Key and Api Key secret",
|
||||
|
||||
Reference in New Issue
Block a user