mirror of
https://github.com/louislam/uptime-kuma.git
synced 2026-05-17 00:16:32 +03:00
feat: add Telnyx messaging provider (#7201)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Frank Elsinga <frank@elsinga.de>
This commit is contained in:
41
server/notification-providers/telnyx.js
Normal file
41
server/notification-providers/telnyx.js
Normal file
@@ -0,0 +1,41 @@
|
||||
const NotificationProvider = require("./notification-provider");
|
||||
const axios = require("axios");
|
||||
|
||||
class Telnyx extends NotificationProvider {
|
||||
name = "telnyx";
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
|
||||
const okMsg = "Sent Successfully.";
|
||||
|
||||
try {
|
||||
let data = {
|
||||
from: notification.telnyxPhoneNumber,
|
||||
to: notification.telnyxToNumber,
|
||||
text: msg,
|
||||
};
|
||||
|
||||
if (notification.telnyxMessagingProfileId) {
|
||||
data.messaging_profile_id = notification.telnyxMessagingProfileId;
|
||||
}
|
||||
|
||||
let config = {
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: "Bearer " + notification.telnyxApiKey,
|
||||
},
|
||||
};
|
||||
config = this.getAxiosConfigWithProxy(config);
|
||||
|
||||
await axios.post("https://api.telnyx.com/v2/messages", data, config);
|
||||
|
||||
return okMsg;
|
||||
} catch (error) {
|
||||
this.throwGeneralAxiosError(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Telnyx;
|
||||
@@ -62,6 +62,7 @@ const Teams = require("./notification-providers/teams");
|
||||
const TechulusPush = require("./notification-providers/techulus-push");
|
||||
const Telegram = require("./notification-providers/telegram");
|
||||
const Teltonika = require("./notification-providers/teltonika");
|
||||
const Telnyx = require("./notification-providers/telnyx");
|
||||
const Threema = require("./notification-providers/threema");
|
||||
const Twilio = require("./notification-providers/twilio");
|
||||
const Splunk = require("./notification-providers/splunk");
|
||||
@@ -172,6 +173,7 @@ class Notification {
|
||||
new TechulusPush(),
|
||||
new Telegram(),
|
||||
new Teltonika(),
|
||||
new Telnyx(),
|
||||
new Threema(),
|
||||
new Twilio(),
|
||||
new Splunk(),
|
||||
|
||||
@@ -275,6 +275,7 @@ export default {
|
||||
SevenIO: "SevenIO",
|
||||
SMSEagle: "SMSEagle",
|
||||
SMSPartner: "SMS Partner",
|
||||
telnyx: "Telnyx",
|
||||
Teltonika: this.$t("Teltonika SMS Gateway"),
|
||||
twilio: "Twilio",
|
||||
};
|
||||
|
||||
67
src/components/notifications/Telnyx.vue
Normal file
67
src/components/notifications/Telnyx.vue
Normal file
@@ -0,0 +1,67 @@
|
||||
<template>
|
||||
<div class="mb-3">
|
||||
<label for="telnyx-api-key" class="form-label">{{ $t("telnyxApiKey") }}</label>
|
||||
<HiddenInput
|
||||
id="telnyx-api-key"
|
||||
v-model="$parent.notification.telnyxApiKey"
|
||||
:required="true"
|
||||
autocomplete="new-password"
|
||||
></HiddenInput>
|
||||
<div class="form-text">{{ $t("telnyxApiKeyHelptext") }}</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="telnyx-phone-number" class="form-label">{{ $t("telnyxPhoneNumber") }}</label>
|
||||
<input
|
||||
id="telnyx-phone-number"
|
||||
v-model="$parent.notification.telnyxPhoneNumber"
|
||||
type="text"
|
||||
class="form-control"
|
||||
placeholder="+15551234567"
|
||||
required
|
||||
/>
|
||||
<div class="form-text">{{ $t("telnyxPhoneNumberHelptext") }}</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="telnyx-to-number" class="form-label">{{ $t("telnyxToNumber") }}</label>
|
||||
<input
|
||||
id="telnyx-to-number"
|
||||
v-model="$parent.notification.telnyxToNumber"
|
||||
type="text"
|
||||
class="form-control"
|
||||
placeholder="+15559876543"
|
||||
required
|
||||
/>
|
||||
<div class="form-text">{{ $t("telnyxToNumberHelptext") }}</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="telnyx-messaging-profile-id" class="form-label">{{ $t("telnyxMessagingProfileId") }}</label>
|
||||
<input
|
||||
id="telnyx-messaging-profile-id"
|
||||
v-model="$parent.notification.telnyxMessagingProfileId"
|
||||
type="text"
|
||||
class="form-control"
|
||||
/>
|
||||
<div class="form-text">{{ $t("telnyxMessagingProfileIdHelptext") }}</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<i18n-t tag="p" keypath="More info on:" style="margin-top: 8px">
|
||||
<a href="https://developers.telnyx.com/docs/messaging/messages/send-sms-mms" target="_blank">
|
||||
https://developers.telnyx.com/docs/messaging
|
||||
</a>
|
||||
</i18n-t>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import HiddenInput from "../HiddenInput.vue";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
HiddenInput,
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -63,6 +63,7 @@ import Teams from "./Teams.vue";
|
||||
import TechulusPush from "./TechulusPush.vue";
|
||||
import Telegram from "./Telegram.vue";
|
||||
import Teltonika from "./Teltonika.vue";
|
||||
import Telnyx from "./Telnyx.vue";
|
||||
import Threema from "./Threema.vue";
|
||||
import Twilio from "./Twilio.vue";
|
||||
import Webhook from "./Webhook.vue";
|
||||
@@ -159,6 +160,7 @@ const NotificationFormList = {
|
||||
teams: Teams,
|
||||
telegram: Telegram,
|
||||
Teltonika: Teltonika,
|
||||
telnyx: Telnyx,
|
||||
threema: Threema,
|
||||
twilio: Twilio,
|
||||
Splunk: Splunk,
|
||||
|
||||
@@ -1022,6 +1022,14 @@
|
||||
"ntfyCustomTitle": "Custom Title Template",
|
||||
"ntfyCustomMessage": "Custom Message Template",
|
||||
"ntfyNotificationTemplateFallback": "Leave blank to use the default Uptime Kuma format",
|
||||
"telnyxApiKey": "API Key (V2)",
|
||||
"telnyxApiKeyHelptext": "Your Telnyx V2 API key from the Telnyx Portal under API Keys",
|
||||
"telnyxPhoneNumber": "From Number",
|
||||
"telnyxPhoneNumberHelptext": "Your Telnyx phone number to send from (must be registered in your Telnyx account, e.g. +15551234567)",
|
||||
"telnyxToNumber": "To Number",
|
||||
"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",
|
||||
"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