diff --git a/server/notification-providers/serwersms.js b/server/notification-providers/serwersms.js index f7c8644af..1f4740fa8 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", } }; + + // Use phone as first option 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}`; diff --git a/src/components/notifications/SerwerSMS.vue b/src/components/notifications/SerwerSMS.vue index 32a0ff7a8..5d7398bd6 100644 --- a/src/components/notifications/SerwerSMS.vue +++ b/src/components/notifications/SerwerSMS.vue @@ -8,7 +8,7 @@
- +
diff --git a/src/lang/pl.json b/src/lang/pl.json index 0b45ca3a4..4440ca322 100644 --- a/src/lang/pl.json +++ b/src/lang/pl.json @@ -361,6 +361,7 @@ "serwersmsAPIUser": "Nazwa użytkownika API (z prefiksem webapi_)", "serwersmsAPIPassword": "Hasło API", "serwersmsPhoneNumber": "Numer telefonu", + "serwersmsPhoneNumberGroupId": "Numer telefonu lub ID Grupy", "serwersmsSenderName": "Nazwa nadawcy (zatwierdzona w panelu klienta)", "smseagle": "SMSEagle", "smseagleTo": "Numer/y telefonu",