Portal Community

userGroup/getUsers

Retrieve the list of user IDs that are members of a specific Slack User Group. Returns all member IDs for the group, optionally including members of disabled groups.

When to Use

Add User Safely: Before adding a single user with userGroup/addUsers, always call userGroup/getUsers first to retrieve the current membership list, then append the new user ID and pass the complete updated list. userGroup/addUsers replaces the entire membership, not appends.

Configuration

Connection

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

Operation Fields

FieldRequiredDescription
userGroupIdRequiredThe Slack user group identifier (starts with S). Obtain from userGroup/getMany or userGroup/create.
includeDisabledOptionalBoolean. Default true. When true, includes members of disabled groups. Set to false to return empty results for disabled groups.

Sample Configuration

{
  "operation": "userGroup/getUsers",
  "connection": {
    "botToken": "{{ $credentials.slackBot.token }}"
  },
  "userGroupId": "S08ONCALL01",
  "includeDisabled": true
}

Validation Errors

Error CodeCauseResolution
no_such_subteamNo user group with the given ID exists in the workspace.Verify the group ID using userGroup/getMany.
missing_scopeToken lacks the usergroups:read scope.Add usergroups:read under OAuth & Permissions and reinstall the app.
invalid_authBot token is invalid or revoked.Regenerate the token and update the credential store.

Output

Success Port

FieldTypeDescription
userCountnumberTotal number of members in the group.
userIdsarrayArray of Slack user ID strings (each starting with U). Empty array if the group has no members.
statusstring"success" on successful retrieval.
errorCodestringEmpty on success. Slack API error code on failure.
payloadobjectRaw Slack API response.

Error Port

Activated when the group does not exist or the token lacks read permissions. An empty userIds array is a valid successful response for groups with no members.

Sample Output

{
  "userCount": 3,
  "userIds": ["U01ENG001", "U01ENG002", "U01ENG003"],
  "status": "success",
  "errorCode": "",
  "payload": {
    "ok": true,
    "users": ["U01ENG001", "U01ENG002", "U01ENG003"]
  }
}

Expression Reference

ExpressionResult
{{ $output.getGroupUsers.userIds }}Full array of member IDs — pass to loop node for bulk operations or to userGroup/addUsers for safe append.
{{ $output.getGroupUsers.userCount }}Group member count for logging or reporting.
{{ $output.getGroupUsers.userIds.join(',') }}Comma-separated user IDs string — pass directly to userGroup/addUsers after appending a new ID.

Node Policies & GuardRails

Policy AreaRecommendation
Safe Append PatternAlways call userGroup/getUsers before userGroup/addUsers when adding a single member. addUsers replaces the entire list — omitting this step will remove existing members.
Empty Group HandlingAn empty userIds array is a valid result. Always handle the zero-member case in conditional branches downstream.
Membership VerificationTo check if a specific user is in a group, retrieve the userIds array and check if the target user ID is included. There is no direct "is user in group" API call.
External SyncWhen syncing group membership to external systems, include the group ID and sync timestamp alongside the member list for auditability.
Rate LimitsSlack's usergroups.users.list is Tier 2. Avoid calling this in tight loops — fetch once and cache for the workflow execution.

Examples

Verify User is On-Call Before Routing Incident

Before routing an incident DM, confirm the target user is currently in the on-call group.

{
  "operation": "userGroup/getUsers",
  "userGroupId": "S08ONCALL01"
}
// Check: $output.getGroupUsers.userIds.includes($input.targetUserId)

Safe Add User to Existing Group

Add a new member to the @reviewers group without removing existing members.

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

Sync Group Membership to External System

Retrieve group members and write them to an external access control system for audit.

{
  "operation": "userGroup/getUsers",
  "userGroupId": "{{ $input.accessGroupId }}",
  "includeDisabled": false
}
// Write { groupId, userIds, syncedAt } to access control database