Browse Source
Merge pull request #605 from NixNotCastey/promosms
Add PromoSMS as notification provider
pull/609/head
Louis Lam
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with
112 additions and
0 deletions
server/notification-providers/promosms.js
server/notification.js
src/components/notifications/PromoSMS.vue
src/components/notifications/index.js
src/languages/bg-BG.js
src/languages/da-DK.js
src/languages/de-DE.js
src/languages/en.js
src/languages/es-ES.js
src/languages/et-EE.js
src/languages/fa.js
src/languages/fr-FR.js
src/languages/hu.js
src/languages/it-IT.js
src/languages/ja.js
src/languages/ko-KR.js
src/languages/nl-NL.js
src/languages/pl.js
src/languages/pt-BR.js
src/languages/ru-RU.js
src/languages/sr-latn.js
src/languages/sr.js
src/languages/sv-SE.js
src/languages/tr-TR.js
src/languages/zh-CN.js
src/languages/zh-HK.js
@ -0,0 +1,41 @@
const NotificationProvider = require ( "./notification-provider" ) ;
const axios = require ( "axios" ) ;
class PromoSMS extends NotificationProvider {
name = "promosms" ;
async send ( notification , msg , monitorJSON = null , heartbeatJSON = null ) {
let okMsg = "Sent Successfully." ;
try {
let config = {
headers : {
"Content-Type" : "application/json" ,
"Authorization" : "Basic " + Buffer . from ( notification . promosmsLogin + ":" + notification . promosmsPassword ) . toString ( 'base64' ) ,
"Accept" : "text/json" ,
}
} ;
let data = {
"recipients" : [ notification . promosmsPhoneNumber ] ,
//Lets remove non ascii char
"text" : msg . replace ( /[^\x00-\x7F]/g , "" ) ,
"type" : Number ( notification . promosmsSMSType ) ,
"sender" : notification . promosmsSenderName
} ;
let resp = await axios . post ( "https://promosms.com/api/rest/v3_2/sms" , data , config ) ;
if ( resp . data . response . status !== 0 ) {
let error = "Something gone wrong. Api returned " + resp . data . response . status + "." ;
this . throwGeneralAxiosError ( error ) ;
}
return okMsg ;
} catch ( error ) {
this . throwGeneralAxiosError ( error ) ;
}
}
}
module . exports = PromoSMS ;
@ -7,6 +7,7 @@ const LunaSea = require("./notification-providers/lunasea");
const Mattermost = require ( "./notification-providers/mattermost" ) ;
const Matrix = require ( "./notification-providers/matrix" ) ;
const Octopush = require ( "./notification-providers/octopush" ) ;
const PromoSMS = require ( "./notification-providers/promosms" ) ;
const Pushbullet = require ( "./notification-providers/pushbullet" ) ;
const Pushover = require ( "./notification-providers/pushover" ) ;
const Pushy = require ( "./notification-providers/pushy" ) ;
@ -37,6 +38,7 @@ class Notification {
new Mattermost ( ) ,
new Matrix ( ) ,
new Octopush ( ) ,
new PromoSMS ( ) ,
new Pushbullet ( ) ,
new Pushover ( ) ,
new Pushy ( ) ,
@ -0,0 +1,39 @@
< template >
< div class = "mb-3" >
< label for = "promosms-login" class = "form-label" > API LOGIN < / label >
< input id = "promosms-login" v -model = " $ parent.notification.promosmsLogin " type = "text" class = "form-control" required >
< label for = "promosms-key" class = "form-label" > API PASSWORD < / label >
< HiddenInput id = "promosms-key" v-model ="$parent.notification.promosmsPassword" :required="true" autocomplete="one-time-code" > < / HiddenInput >
< / div >
< div class = "mb-3" >
< label for = "promosms-type-sms" class = "form-label" > { { $t ( "SMS Type" ) } } < / label >
< select id = "promosms-type-sms" v-model ="$parent.notification.promosmsSMSType" class="form-select" >
< option value = "0" > { { $t ( "promosmsTypeFlash" ) } } < / option >
< option value = "1" > { { $t ( "promosmsTypeEco" ) } } < / option >
< option value = "2" > { { $t ( "promosmsTypeFull" ) } } < / option >
< option value = "3" > { { $t ( "promosmsTypeSpeed" ) } } < / option >
< / select >
< i18n -t tag = "div" keypath = "Check PromoSMS prices" class = "form-text" >
< a href = "https://promosms.com/cennik/" target = "_blank" > https : / / p r o m o s m s . c o m / c e n n i k / < / a >
< / i 1 8 n - t >
< / div >
< div class = "mb-3" >
< label for = "promosms-phone-number" class = "form-label" > { { $t ( "promosmsPhoneNumber" ) } } < / label >
< input id = "promosms-phone-number" v -model = " $ parent.notification.promosmsPhoneNumber " type = "text" class = "form-control" required >
< / div >
< div class = "mb-3" >
< label for = "promosms-sender-name" class = "form-label" > { { $t ( "promosmsSMSSender" ) } } < / label >
< input id = "promosms-sender-name" v-model ="$parent.notification.promosmsSenderName" type="text" minlength="3" maxlength="11" class="form-control" >
< / div >
< / template >
< script >
import HiddenInput from "../HiddenInput.vue" ;
export default {
components : {
HiddenInput ,
} ,
} ;
< / script >
@ -10,6 +10,7 @@ import Teams from "./Teams.vue";
import Pushover from "./Pushover.vue" ;
import Pushy from "./Pushy.vue" ;
import Octopush from "./Octopush.vue" ;
import PromoSMS from "./PromoSMS.vue" ;
import LunaSea from "./LunaSea.vue" ;
import Apprise from "./Apprise.vue" ;
import Pushbullet from "./Pushbullet.vue" ;
@ -35,6 +36,7 @@ const NotificationFormList = {
"pushover" : Pushover ,
"pushy" : Pushy ,
"octopush" : Octopush ,
"promosms" : PromoSMS ,
"lunasea" : LunaSea ,
"apprise" : Apprise ,
"pushbullet" : Pushbullet ,
@ -190,6 +190,7 @@ export default {
pushover : "Pushover" ,
pushy : "Pushy" ,
octopush : "Octopush" ,
promosms : "PromoSMS" ,
lunasea : "LunaSea" ,
apprise : "Apprise (Поддържа 50+ услуги за инвестяване)" ,
pushbullet : "Pushbullet" ,
@ -192,6 +192,7 @@ export default {
pushover : "Pushover" ,
pushy : "Pushy" ,
octopush : "Octopush" ,
promosms : "PromoSMS" ,
lunasea : "LunaSea" ,
apprise : "Apprise (Support 50+ Notification services)" ,
pushbullet : "Pushbullet" ,
@ -191,6 +191,7 @@ export default {
pushover : "Pushover" ,
pushy : "Pushy" ,
octopush : "Octopush" ,
promosms : "PromoSMS" ,
lunasea : "LunaSea" ,
apprise : "Apprise (Support 50+ Notification services)" ,
pushbullet : "Pushbullet" ,
@ -235,6 +235,7 @@ export default {
pushover : "Pushover" ,
pushy : "Pushy" ,
octopush : "Octopush" ,
promosms : "PromoSMS" ,
lunasea : "LunaSea" ,
apprise : "Apprise (Support 50+ Notification services)" ,
pushbullet : "Pushbullet" ,
@ -273,5 +274,11 @@ export default {
aboutIconURL : "You can provide a link to a picture in \"Icon URL\" to override the default profile picture. Will not be used if Icon Emoji is set." ,
aboutMattermostChannelName : "You can override the default channel that webhook posts to by entering the channel name into \"Channel Name\" field. This needs to be enabled in Mattermost webhook settings. Ex: #other-channel" ,
"matrix" : "Matrix" ,
promosmsTypeEco : "SMS ECO - cheap but slow and often overloaded. Limited only to Polish recipients." ,
promosmsTypeFlash : "SMS FLASH - Message will automatically show on recipient device. Limited only to Polish recipients." ,
promosmsTypeFull : "SMS FULL - Premium tier of SMS, You can use Your Sender Name (You need to register name first). Reliable for alerts." ,
promosmsTypeFull : "SMS SPEED - Highest priority in system. Very quick and reliable but costly (about twice of SMS FULL price)." ,
promosmsPhoneNumber : "Phone number (for Polish recipient You can skip area codes)" ,
promosmsSMSSender : "SMS Sender Name : Pre-registred name or one of defaults: InfoSMS, SMS Info, MaxSMS, INFO, SMS" ,
// End notification form
} ;
@ -192,6 +192,7 @@ export default {
pushover : "Pushover" ,
pushy : "Pushy" ,
octopush : "Octopush" ,
promosms : "PromoSMS" ,
lunasea : "LunaSea" ,
apprise : "Apprise (Support 50+ Notification services)" ,
pushbullet : "Pushbullet" ,
@ -191,6 +191,7 @@ export default {
pushover : "Pushover" ,
pushy : "Pushy" ,
octopush : "Octopush" ,
promosms : "PromoSMS" ,
lunasea : "LunaSea" ,
apprise : "Apprise (vahendab üle 65 teavitusteenust)" ,
pushbullet : "Pushbullet" ,
@ -199,6 +199,7 @@ export default {
pushover : "Pushover" ,
pushy : "Pushy" ,
octopush : "Octopush" ,
promosms : "PromoSMS" ,
lunasea : "LunaSea" ,
apprise : "Apprise (Support 50+ Notification services)" ,
pushbullet : "Pushbullet" ,
@ -192,6 +192,7 @@ export default {
pushover : "Pushover" ,
pushy : "Pushy" ,
octopush : "Octopush" ,
promosms : "PromoSMS" ,
lunasea : "LunaSea" ,
apprise : "Apprise (Support 50+ Notification services)" ,
pushbullet : "Pushbullet" ,
@ -190,6 +190,7 @@ export default {
pushover : "Pushover" ,
pushy : "Pushy" ,
octopush : "Octopush" ,
promosms : "PromoSMS" ,
lunasea : "LunaSea" ,
apprise : "Apprise (Support 50+ Notification services)" ,
pushbullet : "Pushbullet" ,
@ -191,6 +191,7 @@ export default {
pushover : "Pushover" ,
pushy : "Pushy" ,
octopush : "Octopush" ,
promosms : "PromoSMS" ,
lunasea : "LunaSea" ,
apprise : "Apprise (Support 50+ Notification services)" ,
pushbullet : "Pushbullet" ,
@ -192,6 +192,7 @@ export default {
pushover : "Pushover" ,
pushy : "Pushy" ,
octopush : "Octopush" ,
promosms : "PromoSMS" ,
lunasea : "LunaSea" ,
apprise : "Apprise (Support 50+ Notification services)" ,
pushbullet : "Pushbullet" ,
@ -192,6 +192,7 @@ export default {
pushover : "Pushover" ,
pushy : "Pushy" ,
octopush : "Octopush" ,
promosms : "PromoSMS" ,
lunasea : "LunaSea" ,
apprise : "Apprise (Support 50+ Notification services)" ,
pushbullet : "Pushbullet" ,
@ -192,6 +192,7 @@ export default {
pushover : "Pushover" ,
pushy : "Pushy" ,
octopush : "Octopush" ,
promosms : "PromoSMS" ,
lunasea : "LunaSea" ,
apprise : "Apprise (Support 50+ Notification services)" ,
pushbullet : "Pushbullet" ,
@ -192,6 +192,7 @@ export default {
pushover : "Pushover" ,
pushy : "Pushy" ,
octopush : "Octopush" ,
promosms : "PromoSMS" ,
lunasea : "LunaSea" ,
apprise : "Apprise (obsługuje 50+ usług powiadamiania)" ,
pushbullet : "Pushbullet" ,
@ -191,6 +191,7 @@ export default {
pushover : "Pushover" ,
pushy : "Pushy" ,
octopush : "Octopush" ,
promosms : "PromoSMS" ,
lunasea : "LunaSea" ,
apprise : "Apprise (Support 50+ Notification services)" ,
pushbullet : "Pushbullet" ,
@ -196,6 +196,7 @@ export default {
pushover : "Pushover" ,
pushy : "Pushy" ,
octopush : "Octopush" ,
promosms : "PromoSMS" ,
lunasea : "LunaSea" ,
apprise : "Apprise (Support 50+ Notification services)" ,
pushbullet : "Pushbullet" ,
@ -192,6 +192,7 @@ export default {
pushover : "Pushover" ,
pushy : "Pushy" ,
octopush : "Octopush" ,
promosms : "PromoSMS" ,
lunasea : "LunaSea" ,
apprise : "Apprise (Support 50+ Notification services)" ,
pushbullet : "Pushbullet" ,
@ -192,6 +192,7 @@ export default {
pushover : "Pushover" ,
pushy : "Pushy" ,
octopush : "Octopush" ,
promosms : "PromoSMS" ,
lunasea : "LunaSea" ,
apprise : "Apprise (Support 50+ Notification services)" ,
pushbullet : "Pushbullet" ,
@ -192,6 +192,7 @@ export default {
pushover : "Pushover" ,
pushy : "Pushy" ,
octopush : "Octopush" ,
promosms : "PromoSMS" ,
lunasea : "LunaSea" ,
apprise : "Apprise (Support 50+ Notification services)" ,
pushbullet : "Pushbullet" ,
@ -191,6 +191,7 @@ export default {
pushover : "Pushover" ,
pushy : "Pushy" ,
octopush : "Octopush" ,
promosms : "PromoSMS" ,
lunasea : "LunaSea" ,
apprise : "Apprise (Support 50+ Notification services)" ,
pushbullet : "Pushbullet" ,
@ -192,6 +192,7 @@ export default {
pushover : "Pushover" ,
pushy : "Pushy" ,
octopush : "Octopush" ,
promosms : "PromoSMS" ,
lunasea : "LunaSea" ,
apprise : "Apprise (Support 50+ Notification services)" ,
pushbullet : "Pushbullet" ,
@ -192,6 +192,7 @@ export default {
pushover : "Pushover" ,
pushy : "Pushy" ,
octopush : "Octopush" ,
promosms : "PromoSMS" ,
lunasea : "LunaSea" ,
apprise : "Apprise (支援 50 多種通知)" ,
pushbullet : "Pushbullet" ,