> For the complete documentation index, see [llms.txt](https://docs.octoxlabs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.octoxlabs.com/action-center/slack/assign-group-to-users.md).

# Assign Group To Users

Adds the selected users to an existing Slack user group. The job first reads the group's current members, merges them with the selected users (without duplicates) and writes the combined list back with Slack's `usergroups.users.update` API. Existing members are therefore kept.

### Before you begin

* A Slack API token: a user token (`xoxp-`) with the scope `usergroups:write`. Organization-level tokens (`xoxa-`) work only when you also enter a Team id. Enter it in **Slack API Token**.
* Asset type: **User** only (`allowed_asset_types` is `user`).
* Required column: `Specifics.slack.id`. Users whose Slack ID is empty are skipped without a message.
* Job defaults: Slack Domain, Slack API Token and the other fields can be saved as defaults for this job in [Action Center Settings](broken://pages/fa25776ab251a33bb2a7e69faf62f677f3b76280).

### Settings

| Setting                     | Type | Required | Default     | Description                                                                                                                      |
| --------------------------- | ---- | -------- | ----------- | -------------------------------------------------------------------------------------------------------------------------------- |
| Slack Domain                | Text | No       | `slack.com` | The Slack domain the requests are sent to. Requests go to `https://<domain>/api/...`.                                            |
| Slack API Token             | Text | Yes      | None        | User token (`xoxp-`) with scope `usergroups:write`. Not masked after saving.                                                     |
| Group id                    | Text | Yes      | None        | The ID of the user group, for example `S01234567`.                                                                               |
| team\_id (shown as Team id) | Text | No       | None        | Slack Team ID. Needed only with an organization-level token (`xoxa-`). The job sends it only when the token starts with `xoxa-`. |

The labels **Group id** and **Team id** are derived from the field names because the product defines no label for them.

### How it works

* Calls `usergroups.users.list` for the group. If that fails, the job fails with `Failed to fetch current group users: <code>`.
* Collects the Slack IDs of the selected users. Users that have no value in `Specifics.slack.id` are filtered out before the job runs. If none have one, the job fails with `No Slack user IDs found in the selected users.`
* Sends one `usergroups.users.update` request with the current members plus the selected users.
* If Slack answers with an error, the job fails with the message `<Slack API ...> error: <Slack error code>`, the run stops and the error appears under **Error Details** in **History**.
* Passes the same assets it received to the next node.

### Example

| Setting         | Value                  |
| --------------- | ---------------------- |
| Slack Domain    | `slack.com`            |
| Slack API Token | `YOUR_SLACK_API_TOKEN` |
| Group id        | `S01234567`            |

### What's next?

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>About Action Center</strong></td><td>Workflows, triggers, conditions and job nodes.</td><td><a href="broken://pages/c53d026b9438b74e5c96c7a59bb6d75211026536">Broken link</a></td></tr><tr><td><strong>Action Center Settings</strong></td><td>Save default values for this job.</td><td><a href="broken://pages/fa25776ab251a33bb2a7e69faf62f677f3b76280">Broken link</a></td></tr><tr><td><strong>Create Group</strong></td><td>Create a Slack user group.</td><td><a href="broken://pages/37d9d5e0f894e2bc72d5af830106ebc5c548b88f">Broken link</a></td></tr><tr><td><strong>Update Group</strong></td><td>Change a Slack user group.</td><td><a href="broken://pages/ab58b35f6f13a552d7422e9c7d917dd7a0ab7ed2">Broken link</a></td></tr></tbody></table>

{% hint style="info" %}
Available starting from version 6.3.0.
{% endhint %}
