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 @@