Skip to main content
Question

need some help with sending message to multiple recipients using send_message

  • March 17, 2026
  • 3 replies
  • 63 views

rajeev.saraf
Forum|alt.badge.img+3

 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");

        }

 

3 replies

Kevin Mok
Forum|alt.badge.img+1
  • 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
Forum|alt.badge.img+3
  • Author
  • 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");

        }

 


Kevin Mok
Forum|alt.badge.img+1
  • 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")
}
}