From 929f62cb686371112ab17ce7b847a708ccfc53fb Mon Sep 17 00:00:00 2001 From: edo2313 <32812884+edo2313@users.noreply.github.com> Date: Mon, 8 Jan 2024 22:08:57 +0100 Subject: [PATCH] Added translation strings, made the API work with group IDs and fixed the HTML --- server/notification-providers/whapi.js | 12 ++++------- src/components/notifications/Whapi.vue | 28 +++++++++++++++++--------- src/lang/en.json | 5 ++++- 3 files changed, 27 insertions(+), 18 deletions(-) diff --git a/server/notification-providers/whapi.js b/server/notification-providers/whapi.js index 8153753a..a13cb028 100644 --- a/server/notification-providers/whapi.js +++ b/server/notification-providers/whapi.js @@ -12,26 +12,22 @@ class Whapi extends NotificationProvider { let okMsg = "Sent Successfully."; - let apiUrl = notification.whapiApiUrl; - let apiToken = notification.whapiAuthToken; - let toNumber = notification.whapiToNumber; - try { - let config = { + const config = { headers: { "Accept": "application/json", "Content-Type": "application/json", - "Authorization": "Bearer " + apiToken, + "Authorization": "Bearer " + notification.whapiAuthToken, } }; let data = { - "to": toNumber + "@s.whatsapp.net", + "to": notification.whapiRecipient, "body": msg, }; - let url = apiUrl + "/messages/text"; + let url = notification.whapiApiUrl + "/messages/text"; await axios.post(url, data, config); diff --git a/src/components/notifications/Whapi.vue b/src/components/notifications/Whapi.vue index b7ede086..d308cfce 100644 --- a/src/components/notifications/Whapi.vue +++ b/src/components/notifications/Whapi.vue @@ -6,18 +6,28 @@