feat: Multi number notifications for SMSIR (#6346)

This commit is contained in:
Amirparsa Baghdadi 2025-11-13 18:04:01 +03:30 committed by GitHub
parent a7b2624c2d
commit 319edddae5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 33 additions and 21 deletions

View file

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

View file

@ -4,8 +4,8 @@
<HiddenInput id="smsir-key" v-model="$parent.notification.smsirApiKey" :required="true" autocomplete="new-password"></HiddenInput>
</div>
<div class="mb-3">
<label for="smsir-number" class="form-label">{{ $t("Recipient Number") }}</label>
<input id="smsir-number" v-model="$parent.notification.smsirNumber" placeholder="9123456789" type="text" maxlength="11" minlength="10" class="form-control" required>
<label for="smsir-number" class="form-label">{{ $t("Recipient Numbers") }}</label>
<input id="smsir-number" v-model="$parent.notification.smsirNumber" placeholder="9123456789,09987654321" type="text" minlength="10" class="form-control" required>
</div>
<div class="mb-3">
<label for="smsir-template" class="form-label">{{ $t("Template ID") }}</label>

View file

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