Skip to main content
rajeev.saraf
Known Participant
March 17, 2026
Question

need some help with sending message to multiple recipients using send_message

  • March 17, 2026
  • 8 replies
  • 174 views

 Hi , I am sending the teams nudge using moveworks send_message API, the nudge only works for 1 email id not for multiple. can someone please help here.

 

following is the code for the reference.

        var recipientEmail = event.parm1;
// value being passed in event.parm1 is -> email1@example.com,email2@example.com

        var summary = event.parm2;

// nudge works with following hard coded values
    //    emailRecipient = ["email1@example.com", "email2@example.com"];

// following code is to get the list of string
        var colSplit = recipientEmail.split(",");
// logging result is [colSplit 1 -- object]
gs.log("colSplit 1" + "--" + typeof colSplit);
var arr = [];
for (i = 0; i < colSplit.length; i++) {
arr.push(colSplit[i]);
}




       try {

            var moveworksAPI = new MoveworksApiSdk();
// nudge only works for 1 email id, not for multiple
            moveworksAPI.send_message(arr, summary.toString(), event_id);



        } catch (ex) {

            var message = ex.message;

            gs.log("Error: " + message + " Recipient email" + recipientEmail, "moveworks.error");

        }

 

8 replies

Kevin Mok
Community Manager
March 17, 2026

Instead of using the new arr variable that’s created. Can’t you just use the variable colSplit?

In JS when you use the split method like that colSplit should already be [“email1”, “email2”,...]

You don’t need to initialize another array, that may be causing issues.

 

rajeev.saraf
Known Participant
March 18, 2026

Instead of using the new arr variable that’s created. Can’t you just use the variable colSplit?

In JS when you use the split method like that colSplit should already be [“email1”, “email2”,...]

You don’t need to initialize another array, that may be causing issues.

 

I tried , but that didn’t work

        var recipientEmail = event.parm1;
// value being passed in event.parm1 is -> email1@example.com,email2@example.com

        var summary = event.parm2;

// nudge works with following hard coded values
    //    emailRecipient = ["email1@example.com", "email2@example.com"];

// following code is to get the list of string
        var colSplit = recipientEmail.split(",");
// logging result is [colSplit 1 -- object]
gs.log("colSplit 1" + "--" + typeof colSplit);
// var arr = [];
// for (i = 0; i < colSplit.length; i++) {
// arr.push(colSplit[i]);
// }




       try {

            var moveworksAPI = new MoveworksApiSdk();
// nudge only works for 1 email id, not for multiple
            moveworksAPI.send_message(colSplit, summary.toString(), event_id);



        } catch (ex) {

            var message = ex.message;

            gs.log("Error: " + message + " Recipient email" + recipientEmail, "moveworks.error");

        }

 

Rajeev
Kevin Mok
Community Manager
March 18, 2026

Are you able to log the response of the send_message function? Also log out the array of user emails.

 

Also, as an alternative you could call send_message for each user in a loop and see if that works… something such as:

var moveworksAPI = new MoveworksApiSdk();

for (var email of colSplit) {
try {
moveworksAPI.send_message([email], summary.toString(), event_id)
} catch (error) {
gs.log("Error: " + error.message + " Recipient email: " + email, " moveworks.error")
}
}

 

rajeev.saraf
Known Participant
March 19, 2026

Hi ​@Kevin Mok 

It was not the problem with script but some of the email address were not ingested within Moveworks planform.

The resultant was, the api was not sending nudges to any of recipients. 

Do we know in such case, does API throw any exception as there was nothing caught in my logs.

 

 

Rajeev
Kevin Mok
Community Manager
March 19, 2026

As far as I know, we don’t have public facing logs for Events API -- Is there a reason you prefer this over using webhooks?

rajeev.saraf
Known Participant
March 26, 2026

As far as I know, we don’t have public facing logs for Events API -- Is there a reason you prefer this over using webhooks?

because event has higher rate limit as it works in a min time frame i.e. 120 call / min, where Webhook call might fail due to per second transection limit. In case of sending any nudge using scheduled job would exhaust the webhook limit.

Rajeev
Kevin Mok
Community Manager
March 26, 2026

Understood ​@rajeev.saraf - We recently upgraded the limit from 5 req/s to 50 req/s which gives you 3,000 requests per minute

rajeev.saraf
Known Participant
March 27, 2026

@Kevin Mok - Great!! Now we have to start transiting all our events to Webhook setup.

Rajeev