From 1ece0faa76e6eefed908234cc4873fa85d88dc37 Mon Sep 17 00:00:00 2001 From: lci-sinersio <113027200+lci-sinersio@users.noreply.github.com> Date: Mon, 3 Jun 2024 14:19:31 +0200 Subject: [PATCH] Update serwersms.js Adds the ability to use group_id --- server/notification-providers/serwersms.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/server/notification-providers/serwersms.js b/server/notification-providers/serwersms.js index f7c8644a..0a08e7ff 100644 --- a/server/notification-providers/serwersms.js +++ b/server/notification-providers/serwersms.js @@ -17,6 +17,8 @@ class SerwerSMS extends NotificationProvider { "Content-Type": "application/json", } }; + + // Użyj telefonu jako pierwszej opcji let data = { "username": notification.serwersmsUsername, "password": notification.serwersmsPassword, @@ -27,6 +29,13 @@ class SerwerSMS extends NotificationProvider { let resp = await axios.post(url, data, config); + if (!resp.data.success) { + // If unsuccessful, try using group_id + data.phone = null; // Clear phone number + data.group_id = notification.serwersmsPhoneNumber; + resp = await axios.post(url, data, config); + } + if (!resp.data.success) { if (resp.data.error) { let error = `SerwerSMS.pl API returned error code ${resp.data.error.code} (${resp.data.error.type}) with error message: ${resp.data.error.message}`;