Action

Group message

Posted by dchar, Last update over 6 years ago

Send a message to selected members of a group.

This action is handy when you deal with a group but often want to limit a message to certain people. I find it useful when messaging my family. Some messages go to everyone. A message about soccer practice might go to my spouse and one child. I might message just the kids about Mother’s Day plans.

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

The selections are added to the [[to]] template tag for use in subsequent steps.

The third step is the Drafts Message action. Customize the subject or body to suit your needs. Switch this to the Mail action if you send email to the group.

Steps

  • script

    //
    // Customizations
    //
    const groupTitle = "Send message";
    
    const groupList = {
      "Carol":"7189872886", 
      "Marsha":"5176582457",
      "Jan":"2102801012",
      "Cindy":"7074195401"
    };
  • 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 selected = p.fieldValues["select"];
      const s = selected.map(k => groupList[k]).join(',');
      draft.setTemplateTag('to',s);
    } else {
      context.fail();
    }
    
  • message

    toRecipients
    [[to]]
    subjectTemplate
    bodyTemplate
    [[draft]]

Options

  • After Success Default
    Notification Info
    Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.