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 @@
- + + + https://panel.whapi.cloud/dashboard +
- - - + + +
{{ $t("wayToWriteWhapiRecipient", ["00117612345678", "00117612345678@s.whatsapp.net", "123456789012345678@g.us"]) }}
-
- - https://whapi.cloud/ - -
+ + https://whapi.cloud/ + + diff --git a/src/lang/en.json b/src/lang/en.json index 8f63323e..683bb51b 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -883,5 +883,8 @@ "deleteRemoteBrowserMessage": "Are you sure want to delete this Remote Browser for all monitors?", "GrafanaOncallUrl": "Grafana Oncall URL", "Browser Screenshot": "Browser Screenshot", - "wayToWriteWhapiPhoneNumber": "The phone number with the international prefix, but without the plus sign at the start" + "wayToWriteWhapiRecipient": "The phone number with the international prefix, but without the plus sign at the start ({0}), the Contact ID ({1}) or the Group ID ({2}).", + "wayToGetWhapiUrlAndToken": "You can get the API URL and the token by going into your desired channel from {0}", + "whapiRecipient": "Phone Number / Contact ID / Group ID", + "API URL": "API URL" }