Drafts Action Directory

BCC group message

Posted by dchar, Last update 2 months ago

Send a message to multiple contacts without creating a group message.

The first script step is used to configure the action. Add member names and phone numbers, or email addresses, to the groupList:

const groupList = {
    "Carol": "7189872886",
    "Marsha": "5176582457",
    ...
}

The second step displays a prompt to select one or more members of the group.

  [x] Carol
  [ ] Marsha
  [ ] Jan
  [x] Cindy
Install

Steps

  • script

    //
    // Customizations
    //
    const groupTitle = "Send message";
    
    const groupList = {
      "Carol":"2025550186", 
      "Marsha":"2025550125",
      "Jan":"2025550187",
      "Cindy":"2025550148"
    };
    
    const groupSubject = "";
    
  • script

    let p = Prompt.create()
    p.title = groupTitle;
    
    const vals = Object.keys(groupList);
    p.addSelect("select", "", vals, [], true);
    p.addButton("Ok");
    
    if (p.show()) {
      const body = draft.content;
      const selected = p.fieldValues["select"];
      for (let k of selected) {
        const msg = Message.create();
        msg.toRecipients = [groupList[k]];
        msg.subject = groupSubject;
        msg.body = body;
    
        const success = msg.send();
        if (!success) {
          context.fail("Sending cancelled (" + k + ")");
          break;
        }
      }
    } else {
      context.fail();
    }
    

Options

  • After Success Default
    Notification Info
    Log Level Info

Comments

Actions available in the Action Directory are uploaded by community members. Use appropriate caution reviewing downloaded actions before use.