From 319edddae5633133b2c19c1518289fcbfcfb8a46 Mon Sep 17 00:00:00 2001 From: Amirparsa Baghdadi <76398455+amirparsadd@users.noreply.github.com> Date: Thu, 13 Nov 2025 18:04:01 +0330 Subject: [PATCH] feat: Multi number notifications for SMSIR (#6346) --- server/notification-providers/smsir.js | 47 ++++++++++++++++---------- src/components/notifications/SMSIR.vue | 4 +-- src/lang/en.json | 3 +- 3 files changed, 33 insertions(+), 21 deletions(-) diff --git a/server/notification-providers/smsir.js b/server/notification-providers/smsir.js index 159eccb2c..2adc46b3d 100644 --- a/server/notification-providers/smsir.js +++ b/server/notification-providers/smsir.js @@ -21,26 +21,37 @@ class SMSIR extends NotificationProvider { }; config = this.getAxiosConfigWithProxy(config); - let formattedMobile = notification.smsirNumber; - if (formattedMobile.length === 11 && formattedMobile.startsWith("09") && String(parseInt(formattedMobile)) === formattedMobile.substring(1)) { - // 09xxxxxxxxx Format - formattedMobile = formattedMobile.substring(1); - } + const formattedMobiles = notification.smsirNumber + .split(",") + .map(mobile => { + if (mobile.length === 11 && mobile.startsWith("09") && String(parseInt(mobile)) === mobile.substring(1)) { + // 09xxxxxxxxx Format + return mobile.substring(1); + } - await axios.post( - url, - { - mobile: formattedMobile, - templateId: parseInt(notification.smsirTemplate), - parameters: [ + return mobile; + }); + + // Run multiple network requests at once + const requestPromises = formattedMobiles + .map(mobile => { + axios.post( + url, { - name: "uptkumaalert", - value: msg - } - ] - }, - config - ); + mobile: mobile, + templateId: parseInt(notification.smsirTemplate), + parameters: [ + { + name: "uptkumaalert", + value: msg + } + ] + }, + config + ); + }); + + await Promise.all(requestPromises); return okMsg; } catch (error) { diff --git a/src/components/notifications/SMSIR.vue b/src/components/notifications/SMSIR.vue index e5e0e6407..6ae6e96c3 100644 --- a/src/components/notifications/SMSIR.vue +++ b/src/components/notifications/SMSIR.vue @@ -4,8 +4,8 @@
- - + +
diff --git a/src/lang/en.json b/src/lang/en.json index e1c2d8ab2..beecc5e4f 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -1186,5 +1186,6 @@ "Number of retry attempts if webhook fails": "Number of retry attempts (every 60-180 seconds) if the webhook fails.", "Maximum Retries": "Maximum Retries", "Template ID": "Template ID", - "wayToGetClickSMSIRTemplateID": "Your template must contain an {uptkumaalert} field. You can create a new template {here}." + "wayToGetClickSMSIRTemplateID": "Your template must contain an {uptkumaalert} field. You can create a new template {here}.", + "Recipient Numbers": "Recipient Numbers" }