Slack: Create a User Group
Slack usergroups.create: arguments, response, policy and SDK examples.
← Usergroups operations · Get started
Operation slack.usergroups_create
Provider route: POST /usergroups.create. Alter supplies the connection’s credentials and routing.
Call through Alter
Section titled “Call through Alter”Install @alter-ai/sdk @alter-ai/slack with npm, or alter-sdk-slack with pip. Supply your connected customer’s grant ID and the arguments described below.
import { App } from "@alter-ai/sdk";import { SlackIntegration } from "@alter-ai/slack";
async function execute(input: Parameters<SlackIntegration["usergroups"]["create"]>[0]) { const app = new App({ apiKey: process.env.ALTER_API_KEY! }); try { const provider = new SlackIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! }); const call = await provider.usergroups.create(input); const result = await call.wait(); return result.bodyJson(); } finally { await app.close(); }}import osfrom alter_sdk import Appfrom alter_sdk_slack import SlackIntegration
async def execute(arguments): async with App(api_key=os.environ["ALTER_API_KEY"]) as app: provider = SlackIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]}) call = await provider.usergroups.create(arguments) result = await call.wait() return result.body_json()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
body | object | Required within parent | |
body.additional_channels | string | Optional | A comma separated string of encoded channel IDs for which the User Group can custom add usergroup members too. |
body.channels | string | Optional | A comma separated string of encoded channel IDs for which the User Group uses as a default. |
body.description | string | Optional | A short description of the User Group. |
body.enable_section | boolean | Optional | Configure this user group to show as a sidebar section for all group members. Note: Only relevant if group has 1 or more default channels added. |
body.handle | string | Optional | A mention handle. Must be unique among channels, users and User Groups. |
body.include_count | boolean | Optional | Include the number of users in each User Group. |
body.name | string | Required within parent | A name for the User Group. Must be unique among User Groups. |
body.team_id | string | Optional | Encoded team id where the user group has to be created, required if org token is used. |
Response
Section titled “Response”Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Schema for successful response from usergroups.create method |
ok | boolean | Required within parent | Must equal: true |
usergroup | Model | Optional | Expand Create a User Group — response body — usergroup |
Referenced models: Create a User Group — response body — usergroup
Schemas
Section titled “Schemas”Create a User Group — response body — usergroup
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
auto_provision | boolean | Optional | |
auto_type | JSON | Optional | |
auto_type (anyOf 1) | null | Alternative | |
auto_type (anyOf 2) | string | Alternative | Known values: owner, admin |
channel_count | JSON | Optional | |
channel_count (anyOf 1) | integer | Alternative | |
channel_count (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
created_by | string | Optional | |
date_create | JSON | Optional | |
date_create (anyOf 1) | integer | Alternative | |
date_create (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
date_delete | JSON | Optional | |
date_delete (anyOf 1) | integer | Alternative | |
date_delete (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
date_update | JSON | Optional | |
date_update (anyOf 1) | integer | Alternative | |
date_update (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
deleted_by | JSON | Optional | |
deleted_by (anyOf 1) | null | Alternative | |
deleted_by (anyOf 2) | string | Alternative | |
description | string | Optional | |
enterprise_subteam_id | string | Optional | |
handle | string | Optional | |
id | string | Optional | |
is_external | boolean | Optional | |
is_subteam | boolean | Optional | |
is_usergroup | boolean | Optional | |
name | string | Optional | |
prefs | object | Optional | |
prefs.channels | array | Optional | |
prefs.channels[] | string | Each item | |
prefs.groups | array | Optional | |
prefs.groups[] | string | Each item | |
team_id | string | Optional | |
updated_by | string | Optional | |
user_count | JSON | Optional | |
user_count (anyOf 1) | integer | Alternative | |
user_count (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
users | array | Optional | |
users[] | string | Each item |
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: slack.usergroups_create. Catalog operation: usergroups_create. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.
Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.
Required provider scopes: ["usergroups:write"]