The Slack developer docs are moving! We've been working hard at building out a new docs experience at docs.slack.dev — now in beta! You can start using the new docs today, but we'll keep the content on both sites up to date during the transition.

Managing channels

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:

Action Method
Create a channel admin.conversations.create
Delete a channel admin.conversations.delete
Invite some users admin.conversations.invite
Archive a channel admin.conversations.archive
Unarchive a channel admin.conversations.unarchive
Rename a channel admin.conversations.rename
Search for a channel admin.conversations.search
Convert a public channel to private admin.conversations.convertToPrivate
Convert a private channel to public admin.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:

Action Method
Set permissions admin.conversations.setConversationPrefs
Retrieve already set permissions admin.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:

Action Method
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 channel admin.conversations.getTeams
Disconnect a workspace from a channel admin.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.

Recommended reading