From ed93aae1c2109c5b14061c567598d62a3bcb67e0 Mon Sep 17 00:00:00 2001
From: Alexandre Gagner
Date: Thu, 12 Aug 2021 00:15:53 +0200
Subject: [PATCH] add octopush notification service
---
server/notification.js | 27 ++++++++++++++++++++++
src/components/NotificationDialog.vue | 32 +++++++++++++++++++++++++++
2 files changed, 59 insertions(+)
diff --git a/server/notification.js b/server/notification.js
index 05dae8ad1..1f13ad496 100644
--- a/server/notification.js
+++ b/server/notification.js
@@ -193,6 +193,33 @@ 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
+ }
+ ],
+ "text": msg,
+ "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 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ More info on: https://octopush.com/api-sms-documentation/envoi-de-sms/
+
+
+