Skip to content

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.

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 os
from alter_sdk import App
from 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()
FieldTypePresenceDescription and constraints
$objectRootAdditional keys: not allowed
bodyobjectRequired within parent
body.additional_channelsstringOptionalA comma separated string of encoded channel IDs for which the User Group can custom add usergroup members too.
body.channelsstringOptionalA comma separated string of encoded channel IDs for which the User Group uses as a default.
body.descriptionstringOptionalA short description of the User Group.
body.enable_sectionbooleanOptionalConfigure 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.handlestringOptionalA mention handle. Must be unique among channels, users and User Groups.
body.include_countbooleanOptionalInclude the number of users in each User Group.
body.namestringRequired within parentA name for the User Group. Must be unique among User Groups.
body.team_idstringOptionalEncoded team id where the user group has to be created, required if org token is used.

Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.

FieldTypePresenceDescription and constraints
$objectRootSchema for successful response from usergroups.create method
okbooleanRequired within parentMust equal: true
usergroupModelOptionalExpand Create a User Group — response body — usergroup

Referenced models: Create a User Group — response body — usergroup

Create a User Group — response body — usergroup
FieldTypePresenceDescription and constraints
$objectRoot
auto_provisionbooleanOptional
auto_typeJSONOptional
auto_type (anyOf 1)nullAlternative
auto_type (anyOf 2)stringAlternativeKnown values: owner, admin
channel_countJSONOptional
channel_count (anyOf 1)integerAlternative
channel_count (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
created_bystringOptional
date_createJSONOptional
date_create (anyOf 1)integerAlternative
date_create (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
date_deleteJSONOptional
date_delete (anyOf 1)integerAlternative
date_delete (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
date_updateJSONOptional
date_update (anyOf 1)integerAlternative
date_update (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
deleted_byJSONOptional
deleted_by (anyOf 1)nullAlternative
deleted_by (anyOf 2)stringAlternative
descriptionstringOptional
enterprise_subteam_idstringOptional
handlestringOptional
idstringOptional
is_externalbooleanOptional
is_subteambooleanOptional
is_usergroupbooleanOptional
namestringOptional
prefsobjectOptional
prefs.channelsarrayOptional
prefs.channels[]stringEach item
prefs.groupsarrayOptional
prefs.groups[]stringEach item
team_idstringOptional
updated_bystringOptional
user_countJSONOptional
user_count (anyOf 1)integerAlternative
user_count (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
usersarrayOptional
users[]stringEach item

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"]

Official provider source

Report an issue with this page

Necessary

Required for sign-in, security, authorization, and remembering your choices.

Always active

Analytics

Helps us understand which product and documentation features are useful.

Performance diagnostics

Uses performance tracing and privacy-masked session replay to diagnose problems.

You can change these choices at any time from Cookie settings.