Skip to main content

Managing channels

Welcome to the new home of Slack developer docs!

We're still building and not all features are available quite yet. Enjoy this peek into the future!

Not ready for the future? Return to the past at api.slack.com.

The features within are only available to Slack workspaces on Enterprise Grid plans.

Don't have a paid plan? Join the Developer Program and provision a fully-featured sandbox for free.

The APIs for channel management allow your app to create and control channels within your Enterprise Grid organization. You can achieve anything with your app that could be done with a Slack Admin's channel management tools.

That includes:

  • creating and deleting channels,
  • archiving and unarchiving channels,
  • connecting and disconnecting additional workspaces,
  • and setting posting preferences.

With the help of these APIs, you can streamline and automate the task of channel management, saving your admins time and making their lives more pleasant and productive.

Set up with scopes

Two scopes enable an app to manage channels across an Enterprise Grid org:

All admin.* scopes are obtained using the normal OAuth flow, but there are a few extra requirements. The OAuth installation must:

  • be initiated by an Enterprise Grid admin or owner.
  • take place on the Enterprise Grid org, not on an individual workspace, using the workspace switcher during the install flow.

Installing the app on a workspace

Check out the scope documentation for more detail.

Manage channels

Here are the methods for some of the most common things you'll want to do with channels:

ActionMethod
Create a channeladmin.conversations.create
Delete a channeladmin.conversations.delete
Invite some usersadmin.conversations.invite
Archive a channeladmin.conversations.archive
Unarchive a channeladmin.conversations.unarchive
Rename a channeladmin.conversations.rename
Search for a channeladmin.conversations.search
Convert a public channel to privateadmin.conversations.convertToPrivate
Convert a private channel to publicadmin.conversations.convertToPublic

The reference pages linked above are your best source of info for how to call these methods and what to expect in response.

If you have your channels up and running, you might want to make some modifications to who has permission to post messages and to respond in threads. If so, read on.

Set and get posting preferences

You can decide exactly who can post messages in your channel, and who can respond inside threads with the following methods:

ActionMethod
Set permissionsadmin.conversations.setConversationPrefs
Retrieve already set permissionsadmin.conversations.getConversationPrefs

Here's a quick primer on the admin.conversations.setConversationPrefs method:

To set either who can post or who can respond in threads, you'll use the prefs argument with some stringified JSON. "Stringified JSON" means JSON with white space removed and fields marked by single quotations. Since this argument won't contain more complex characters, you don't need to do further encoding.

For example, to set who can post messages, use the who_can_post field inside your prefs argument:

"prefs": "{'who_can_post':'type:admin,user:U1234'}"

Inside your stringified JSON for who_can_post, you can specify who the permission applies to in a few different ways:

  • by type: you can include all admin users, or just all users in general.
  • by user: you can specifically list users: user:U123ABC456.

The can_thread field works exactly the same inside the prefs object, only it determines who can respond in threads. You can pass both who_can_post and can_thread to the prefs argument in this method at the same time.

For example:

"prefs": "{'who_can_post':'type:admin,user:U1234','can_thread':'type:user'}"

Connect and disconnect other workspaces

You can handle connected workspaces for a channel with the following methods:

ActionMethod
Set the connected workspaces for a channel. Any previously-connected workspaces you do not include will be disconnected.admin.conversations.setTeams
Retrieve the list of workspaces that have already been connected to a channeladmin.conversations.getTeams
Disconnect a workspace from a channeladmin.conversation.disconnectShared

The reference pages linked above are the best way to determine exactly how to call these methods and what to expect in response.

You can connect workspaces to a channel using the admin.conversations.setTeams method.

But you can also set a channel to be available across an entire Enterprise Grid organization with the same method, just by setting the org_channel parameter to true.

Check out the rest of our documentation to see other ways that your app can aid Admins in managing Slack, or send some feedback if you have a feature you'd like to request.