Portal Community

userGroup/addUsers

Set the membership of a Slack User Group by providing the complete list of user IDs. This operation replaces the entire membership list — it does not append to existing members.

REPLACE Semantics: The userIds field replaces the entire membership list. Passing only a single new user ID will remove all other existing members. To safely add one user without removing others: (1) call userGroup/getUsers to retrieve the current list, (2) append the new user ID, (3) call userGroup/addUsers with the full updated list.

When to Use

Configuration

Connection

FieldRequiredDescription
botTokenRequiredSlack Bot Token starting with xoxb-. Requires the usergroups:write OAuth scope.

Operation Fields

FieldRequiredDescription
userGroupIdRequiredThe Slack user group identifier (starts with S). Obtain from userGroup/create or userGroup/getMany.
userIdsRequiredComma-separated list of Slack user IDs to set as the complete group membership (e.g. U01ENG001,U01ENG002,U01ENG003). This list replaces all existing members.

Sample Configuration

{
  "operation": "userGroup/addUsers",
  "connection": {
    "botToken": "{{ $credentials.slackBot.token }}"
  },
  "userGroupId": "S08ONCALL01",
  "userIds": "{{ $output.buildRotation.userIdsCsv }}"
}

Validation Errors

Error CodeCauseResolution
no_such_subteamNo user group with the given ID exists.Verify the group ID using userGroup/getMany.
user_not_foundOne or more of the user IDs in userIds does not exist in the workspace.Validate all user IDs against user/get before building the membership list.
missing_scopeToken lacks usergroups:write scope.Add usergroups:write under OAuth & Permissions and reinstall.
invalid_authBot token is invalid or revoked.Regenerate the token and update the credential store.

Output

Success Port

FieldTypeDescription
userGroupIdstringID of the updated group.
updatedUserCountnumberNew total member count after the update.
statusstring"success" on successful membership update.
errorCodestringEmpty on success. Slack API error code on failure.
payloadobjectRaw Slack API response with the updated group and member list.

Error Port

Activated when the group does not exist, a user ID is invalid, or the token lacks write permissions.

Sample Output

{
  "userGroupId": "S08ONCALL01",
  "updatedUserCount": 3,
  "status": "success",
  "errorCode": "",
  "payload": {
    "ok": true,
    "usergroup": {
      "id": "S08ONCALL01",
      "name": "Platform On-Call",
      "handle": "platform-oncall",
      "user_count": 3,
      "users": ["U01ENG001", "U01ENG002", "U01ENG003"]
    }
  }
}

Expression Reference

ExpressionResult
{{ $output.setGroupUsers.userGroupId }}Group ID for confirmation or downstream operations.
{{ $output.setGroupUsers.updatedUserCount }}New member count for logging or notification messages.
{{ $output.setGroupUsers.status }}Status string for conditional branching.
{{ $output.setGroupUsers.payload.usergroup.users }}Confirmed member ID array in the API response.

Node Policies & GuardRails

Policy AreaRecommendation
Replace Semantics AwarenessThis is the most critical guard for this operation. Always build the complete intended membership list before calling. Never pass only the new user IDs unless your intent is to replace all existing members.
Safe Append PatternTo add a single user: call userGroup/getUsers → append new ID to userIds array → join as comma-separated string → call userGroup/addUsers. This is a two-step atomic pattern.
User ValidationValidate all user IDs before the call. A single invalid user ID in the list will cause the entire operation to fail. Run user IDs through user/get and filter out deactivated or invalid accounts.
Rotation WorkflowsFor automated on-call rotation, maintain the authoritative member list in your scheduling system. Always derive the Slack group membership from the scheduling tool rather than reading it back from Slack.
Empty ListPassing an empty userIds string will remove all members from the group. The group will remain enabled but have zero members — @mentions will not notify anyone.

Examples

Set On-Call Rotation from Scheduling System

Each Monday, replace the @platform-oncall group members with the current week's rotation from PagerDuty.

{
  "operation": "userGroup/addUsers",
  "userGroupId": "S08ONCALL01",
  "userIds": "{{ $output.getRotation.slackUserIdsCsv }}"
}

Safely Add One User Without Removing Others

Add a new engineer to the @reviewers group while keeping existing members.

// Step 1: Get current members
{
  "operation": "userGroup/getUsers",
  "userGroupId": "S08REVIEWS1"
}
// Step 2: Build updated list
// updatedIds = [...$output.getGroupUsers.userIds, $input.newUserId].join(',')
// Step 3: Set the complete updated membership
{
  "operation": "userGroup/addUsers",
  "userGroupId": "S08REVIEWS1",
  "userIds": "{{ updatedIds }}"
}

Initialize Group After Creation

Immediately after creating a new team group, populate it with the initial members.

{
  "operation": "userGroup/addUsers",
  "userGroupId": "{{ $output.createGroup.userGroupId }}",
  "userIds": "{{ $input.initialMemberIds }}"
}