Adds, invites or emails users about joining a group based on the permissions of the requesting user. The function returns a hash of results indicating which operations were attempted and whether they were successful.

In general, this algorithm will auto-add all the users that it can, invite the others, and send emails to eligible invited users (See below for more details)

Here are a couple caveats to be aware of:

  1. If the requestingUser can auto-add to the group (A.K.A. has portal:admin:assignToGroups) no email will be sent, period.
  2. Emails can only be sent to members of the same org as the requesting user if they have been invited (not auto-added) to the group. If emails must to be sent to invited members of a second org (e.g a community org), an authenticated user of the second org must be passed in (see secondaryRO)
  3. If no email is passed in, no email will be sent
  4. If auto-adding fails, the unadded users will be invited


Parameter Type Default Notes
groupId Required string
allUsers Required IUser[]
primaryRO Required IHubRequestOptions

Info and authentication for the requesting user

email Optional IEmail
secondaryRO Optional IHubRequestOptions


The operations attempted, whether they were successful and any errors

Property Type Notes
success boolean
autoAdd Optional ISimpleResult
email Optional ICreateOrgNotificationResult
invite Optional IInviteGroupUsersResult

Function defined in common/src/groups/add-users-workflow/add-users-to-group.ts:46