Listening to Channel Conversion Events

This post was originally made in the Slack Champion Network workspace. To see the original post directly, click here or if you’re part of the Slack Community workspace click here.

As of November 07, 2024, Slack does not have an API event to notify us when a channel is converted from public to private, or vice-versa. To some organizations, it’s imperative for them to know when it happens in order to prevent information from being shared across the org or to even prevent information from being siloed. While there might not be an event to listen to, there is a way to know when this happens.

As of now, there isn’t an event to listen to these changes, but there is a way to do it. The documentation was a bit hard to follow as it’s all over the place and incomplete. Your bot must be in the channel to continue.

Whenever a channel is converted to public or private, a message is posted into the channel notifying the users of the change. It is this message that you have to listen for. Using the channels:history and groups:history scopes, you’ll now start receiving all message notifications to your app blob-sweat Lucky for us, we have message subtypes which categorize what type of message is being sent.

All you need to do is filter by subtype (click the dropdown menu Filtering on message subtypes) by explicitly typing out the event type and the subtype you want filtered. In this scenario, you’d filter by channel_convert_to_public or channel_convert_to_private. You can have it in the same listener function within a list (Python).

Now that it’s filtered, you can continue with your business logic, such as notifying a central team or just tracking it. In the recording shared, I just post back in the channel with a simple message.

This post is in response to a user’s feedback in the Slack Community workspace, which can be found below.

Where I got the idea Blocked names for privacy reasons