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 them; and more complex tasks like 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. To get started, head to the setup section.

Setup with scopes

Two scopes enable an app to manage channels across an Enterprise Grid org: admin.conversations:read and admin.conversations:write.

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. Also, the install must 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.

Create, delete, invite, archive, unarchive

Here's a list of the most common things you'll want to do with channels:

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.

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,subteam:S1234'}"

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

One is by type: you can set posting permissions to include all admin users, or just all users in general.

Another way to specify who the permission applies to is with a group: for example, subteam:S1234.

Finally, you can specifically list users who have the permission: user:U1234.

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,subteam:S1234','can_thread':'type:user'}"

Next up: an overview of setting (and getting) the connected workspaces to a given channel.

Connect and disconnect other workspaces

  • To set the connected workspaces for a channel, use the admin.conversations.setTeams method. Any previously-connected workspaces you do not include will be disconnected. In other words, this method can be used to disconnect workspaces as well as connect them.
  • To retrieve the list of workspaces that have already been connected to a channel, use the admin.conversations.getTeams method.
  • To disconnect a workspace from a channel, use the admin.conversation.disconnectShared method.

At this point, you probably already know that the reference pages linked above are the best way to determine exactly how to call these methods and what to expect in response.

One quick note: 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 Grid org 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