diff --git a/server/notification.js b/server/notification.js index 05dae8ad1..56838513e 100644 --- a/server/notification.js +++ b/server/notification.js @@ -193,6 +193,34 @@ class Notification { console.log(error) return false; } + } else if (notification.type === "octopush") { + try { + let config = { + headers: { + 'api-key': notification.octopushAPIKey, + 'api-login': notification.octopushLogin, + 'cache-control': 'no-cache' + } + }; + let data = { + "recipients": [ + { + "phone_number": notification.octopushPhoneNumber + } + ], + //octopush not supporting non ascii char + "text": msg.replace(/[^\x00-\x7F]/g, ""), + "type": notification.octopushSMSType, + "purpose": "alert", + "sender": notification.octopushSenderName + }; + + await axios.post(`https://api.octopush.com/v1/public/sms-campaign/send`, data, config) + return true; + } catch (error) { + console.log(error) + return false; + } } else if (notification.type === "slack") { try { if (heartbeatJSON == null) { diff --git a/src/components/NotificationDialog.vue b/src/components/NotificationDialog.vue index 6c481681d..a3e72da07 100644 --- a/src/components/NotificationDialog.vue +++ b/src/components/NotificationDialog.vue @@ -22,6 +22,7 @@ + @@ -252,6 +253,37 @@

+ +