From c6237277c05620c8f1e192ee2c56b37de8b079c3 Mon Sep 17 00:00:00 2001 From: jacr13 Date: Mon, 12 Jul 2021 22:06:03 +0200 Subject: [PATCH 1/3] add support for signal notifications --- server/notification.js | 16 ++++++++++ src/components/NotificationDialog.vue | 42 +++++++++++++++++++++++++-- 2 files changed, 55 insertions(+), 3 deletions(-) diff --git a/server/notification.js b/server/notification.js index f8dc67977..ad74082f0 100644 --- a/server/notification.js +++ b/server/notification.js @@ -56,6 +56,22 @@ class Notification { } else if (notification.type === "discord") { return await Notification.discord(notification, msg) + } else if (notification.type === "signal") { + try { + let data = { + "message": msg, + "number": notification.signalNumber, + "recipients": notification.signalRecipients.replace(/\s/g, '').split(",") + }; + let config = {}; + + let res = await axios.post(notification.signalURL, data, config) + return true; + } catch (error) { + console.log(error) + return false; + } + } else { throw new Error("Notification type is not supported") } diff --git a/src/components/NotificationDialog.vue b/src/components/NotificationDialog.vue index c86551616..5f1e32b1e 100644 --- a/src/components/NotificationDialog.vue +++ b/src/components/NotificationDialog.vue @@ -17,6 +17,7 @@ + @@ -44,9 +45,8 @@ Support Direct Chat / Group / Channel's Chat ID

- You can get your chat id by sending message to the bot and go to this url to view the chat_id: -

- + You can ge https://github.com/bbernhard/signal-cli-rest-api +

+ +