mirror of
https://github.com/louislam/uptime-kuma.git
synced 2026-06-23 04:10:14 +00:00
feat(notification): add EgoSMS SMS provider for Uganda (#7434)
Co-authored-by: Kiiza Christian <ckiiza@renu.ac.ug> Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
const NotificationProvider = require("./notification-provider");
|
||||
const axios = require("axios");
|
||||
|
||||
class EgoSMS extends NotificationProvider {
|
||||
name = "egosms";
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
|
||||
const okMsg = "Sent Successfully.";
|
||||
|
||||
try {
|
||||
const params = new URLSearchParams({
|
||||
number: notification.egosmsPhoneNumber,
|
||||
message: msg,
|
||||
username: notification.egosmsUsername,
|
||||
password: notification.egosmsPassword,
|
||||
sender: notification.egosmsSender || "EGOSMS",
|
||||
priority: "0",
|
||||
});
|
||||
|
||||
const url = `https://www.egosms.co/api/v1/plain/?${params.toString()}`;
|
||||
let config = this.getAxiosConfigWithProxy({});
|
||||
const response = await axios.get(url, config);
|
||||
|
||||
return response.data || okMsg;
|
||||
} catch (error) {
|
||||
this.throwGeneralAxiosError(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = EgoSMS;
|
||||
@@ -14,6 +14,7 @@ const DingDing = require("./notification-providers/dingding");
|
||||
const Discord = require("./notification-providers/discord");
|
||||
const Fluxer = require("./notification-providers/fluxer");
|
||||
const Elks = require("./notification-providers/46elks");
|
||||
const EgoSMS = require("./notification-providers/egosms");
|
||||
const Feishu = require("./notification-providers/feishu");
|
||||
const Notifery = require("./notification-providers/notifery");
|
||||
const FreeMobile = require("./notification-providers/freemobile");
|
||||
@@ -124,6 +125,7 @@ class Notification {
|
||||
new Discord(),
|
||||
new Fluxer(),
|
||||
new Elks(),
|
||||
new EgoSMS(),
|
||||
new Feishu(),
|
||||
new FreeMobile(),
|
||||
new GoogleChat(),
|
||||
|
||||
@@ -318,6 +318,7 @@ export default {
|
||||
// Regional - Not supported in most regions or documentation is not in English
|
||||
let regional = {
|
||||
AliyunSMS: "AliyunSMS (阿里云短信服务)",
|
||||
egosms: "EgoSMS (Uganda)",
|
||||
DingDing: "DingDing (钉钉自定义机器人)",
|
||||
Feishu: "Feishu (飞书)",
|
||||
FlashDuty: "FlashDuty (快猫星云)",
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
<template>
|
||||
<div class="mb-3">
|
||||
<label for="egosms-username" class="form-label">{{ $t("API Username") }}</label>
|
||||
<i18n-t tag="div" class="form-text" keypath="wayToGetEgoSMSToken">
|
||||
<a href="https://www.egosms.co/" target="_blank">{{ $t("here") }}</a>
|
||||
</i18n-t>
|
||||
<input
|
||||
id="egosms-username"
|
||||
v-model="$parent.notification.egosmsUsername"
|
||||
type="text"
|
||||
class="form-control"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="egosms-password" class="form-label">{{ $t("Password") }}</label>
|
||||
<HiddenInput
|
||||
id="egosms-password"
|
||||
v-model="$parent.notification.egosmsPassword"
|
||||
:required="true"
|
||||
autocomplete="new-password"
|
||||
></HiddenInput>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="egosms-sender" class="form-label">{{ $t("From Name/Number") }}</label>
|
||||
<input
|
||||
id="egosms-sender"
|
||||
v-model="$parent.notification.egosmsSender"
|
||||
type="text"
|
||||
maxlength="11"
|
||||
class="form-control"
|
||||
placeholder="EGOSMS"
|
||||
/>
|
||||
<div class="form-text">{{ $t("egosmsSenderDescription") }}</div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="egosms-phoneNumber" class="form-label">{{ $t("Recipient Number") }}</label>
|
||||
<input
|
||||
id="egosms-phoneNumber"
|
||||
v-model="$parent.notification.egosmsPhoneNumber"
|
||||
type="text"
|
||||
class="form-control"
|
||||
placeholder="2567XXXXXXXX"
|
||||
required
|
||||
/>
|
||||
<div class="form-text">{{ $t("egosmsPhoneNumberDescription") }}</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import HiddenInput from "../HiddenInput.vue";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
HiddenInput,
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -13,6 +13,7 @@ import DingDing from "./DingDing.vue";
|
||||
import Discord from "./Discord.vue";
|
||||
import Fluxer from "./Fluxer.vue";
|
||||
import Elks from "./46elks.vue";
|
||||
import EgoSMS from "./EgoSMS.vue";
|
||||
import Feishu from "./Feishu.vue";
|
||||
import FreeMobile from "./FreeMobile.vue";
|
||||
import GoogleChat from "./GoogleChat.vue";
|
||||
@@ -112,6 +113,7 @@ const NotificationFormList = {
|
||||
discord: Discord,
|
||||
fluxer: Fluxer,
|
||||
Elks: Elks,
|
||||
egosms: EgoSMS,
|
||||
Feishu: Feishu,
|
||||
FreeMobile: FreeMobile,
|
||||
GoogleChat: GoogleChat,
|
||||
|
||||
@@ -972,6 +972,9 @@
|
||||
"PushDeer Key": "PushDeer Key",
|
||||
"SpugPush Template Code": "Template Code",
|
||||
"wayToGetClickSendSMSToken": "You can get API Username and API Key from {here}.",
|
||||
"wayToGetEgoSMSToken": "You can get your EgoSMS API username and password from {here}.",
|
||||
"egosmsSenderDescription": "Sender ID shown to recipients (max 11 characters). Defaults to EGOSMS if empty.",
|
||||
"egosmsPhoneNumberDescription": "Recipient number with country code, without + or 00 (e.g. 2567XXXXXXXX).",
|
||||
"Custom Monitor Type": "Custom Monitor Type",
|
||||
"Google Analytics ID": "Google Analytics ID",
|
||||
"Analytics Type": "Analytics Type",
|
||||
|
||||
Reference in New Issue
Block a user