From c31ea9c891241635448ae21844ec9cce5beaddcc Mon Sep 17 00:00:00 2001 From: Amirparsa Baghdadi <76398455+amirparsadd@users.noreply.github.com> Date: Wed, 19 Nov 2025 14:22:09 +0330 Subject: [PATCH] Shorten text for SMSIR Notification provider (#6365) Co-authored-by: Frank Elsinga --- server/notification-providers/smsir.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/server/notification-providers/smsir.js b/server/notification-providers/smsir.js index 2adc46b3d..40e5b9cc3 100644 --- a/server/notification-providers/smsir.js +++ b/server/notification-providers/smsir.js @@ -32,6 +32,15 @@ class SMSIR extends NotificationProvider { return mobile; }); + const MAX_MESSAGE_LENGTH = 25; // This is a limitation placed by SMSIR + // Shorten By removing spaces, keeping context is better than cutting off the text + // If that does not work, truncate. Still better than not receiving an SMS + if (msg.length > MAX_MESSAGE_LENGTH && msg.replace(/\s/g, ""). length <= MAX_MESSAGE_LENGTH) { + msg = msg.replace(/\s/g, ""); + } else if (msg.length > MAX_MESSAGE_LENGTH) { + msg = msg.substring(0, MAX_MESSAGE_LENGTH - 1 - "...".length) + "..."; + } + // Run multiple network requests at once const requestPromises = formattedMobiles .map(mobile => {