Random Technology thoughts from an Irish Virtualization Geek (who enjoys saving the world in his spare time).

Converting a Slack Channel from Private to Public

The team I work in are pretty heavy slack users. The organisation we work in is rather large and therefore while we had a need for a single workspace, the situation where everyone could see content from all the channels wasn’t really cutting it.

So we got into the habit of creating dedicated channels for different topics and we had quite a few ‘private’ channels where only those explicitly invited to them could see the content.

Changing a Public Channel to a Private channel is straight-forward and part of Slacks native functionality. However, when we had cause to port a channel to a new workspace we quickly found out that there are a few limitations when it comes to private channels:

You cannot change a private channel back to being a public channel

You cannot export or import a private channel using Slacks native tools.

Not to be undone, I did a bit of digging around, and found a way, with one main caveat – that the import doesn’t like the attachments, screenshots etc. That may be resolvable…it just didn’t bother me enough to work it out.

Details below (provided with no warranty, your mileage may vary, please test with a dummy channel first warnings etc) !

Step 1: Backing up the data

As I mentioned, Slack doesn’t provide this functionality when it comes to private channels, but there is a tool out there that does. Backupery for Slack (https://www.backupery.com/products/backupery-for-slack/) has a free and a paid version. Depending on your needs, you may get away with the free version, which I am going to use for demonstration purposes here. The paid version gives you better scale, so pay the good folks if you are going to use it to get you out of a hole 🙂

Download, install and launch Backupery and you should get a screen like the below.

Click ‘Run backup wizard’.

The subsequent screen relates to the when and where for your backups

You can change the above settings if you want, and then click Start. Most likely this will fail as Backupery isn’t authorized in your Slack Workspace. If thats the case, you will see the screen below

It will also have popped open a browser with something like the below. If you have multiple workspaces make sure you are logged into and are authorizing the correct one!

Once Authorized, the backup should jog on all by itself

Note below the limitations of the free version. Buy the full version if you need to remove them.

If all went well, you should have a backup of your slack data

Step 2: The Magic

So this requires a little bit of JSON skill. A good text editor like Sublime Text or Notepad++ will make your life a bit easier.

Click on the View Backup button from the Status screen in Backupery, and it should open the folder where the backup was stored, and there should be a folder there with the date-time that the backup was taken. Open the folder and the RawBackup subfolder

Here you’ll find a zip file with your backup data. Extract that and open the resulting folder. Let’s consider the resulting extracted folder as the ‘root’ of what we want to manipulate.

Here you have some key files and folders for this process.

The channels.json file and every folder in the root that doest start with an ‘underscore’ relates only to your public channels.

For this post I’m going to convert one private channel called private-channel-one. Remove any public channels folders from the root folder – in this case random and general. Also remove the channels.json from the root.

Peek inside the _privatechannels folder and you will find the files you need

Move the private-channel-one folder and the channels.json up to the root folder and edit the channels.json file

Note the two key values highlighted. Change both is_group and IsPrivateGroup from true to false. Remove any JSON nodes for the channels that you are not messing with just to be safe. Save the JSON file.

Note: If you can process multiple channels at the same time, just make sure that each corresponding folder is moved from the _privatechannels folder to the root, and that you modify the above values for each channel.

Now zip up the root folder into a new zip file. The zip file (in this case) should therefore contain the following

_conversations

_privatechannels

private-channel-one (replace this with your own channel(s))

channels.json

users.json

Note: In my testing, I found that Step 3 (importing) failed when there were attachments. Not obvious at first, as the import silently bombed when it came across the first attachment in the channel. The result is a partial import, up to that point. I just did a rollback (shown later), deleted the attachment files found inside the channel folder (private-channel-one above) as I didn’t really care for them anyway, re-did the zip and redid the import. If anyone takes this testing further to get the attachments in too, let me know and I’ll update the post.

Step 3: Importing the data

In your Slack client click on the private channel in question (note the padlock icon), click the gear icon, additional options, hold on to your underwear, click Delete this Channel and confirm. Make sure you have the original backup zip file in a safe place, and know where your nearest exit is 🙂

Then on the workspace itself, click the drop down, Administration and Workspace Settings.

Click on Import/Export Data

Click on Import next to Slack

Choose the zip file we created earlier and click Start Import

In my experience it will sit with a status of ‘Waiting‘ indefinitely even when its actually done.

But if you refresh, you will see the true status. Click the Information Required button

On the next screen

Change from ‘Unmapped‘ to ‘All‘, leave the default of ‘Map users when possible, and manually configure the rest‘ as is.

Click on ‘expand‘ to view the users, and map them accordingly. If you are doing this within the same workspace it should all line up nicely. If you are also moving the channel to a new workspace, this is an opportunity to map old workspace users to new workspace users, and Slack does a really neat job of making all the old posts look like they were made by new workspace users

Note: You can prune out users that you dont want to do anything with by editing the users.json file found in the root folder in Step 2 before you make the zip for upload. Out of scope here, but if you are comfortable with this process, then that should be a doddle for you.

When all the users are mapped, you are pretty much good to go. The default action is to ‘Create new public channel’ (which is our goal here). You can change that accordingly if you want to do something slightly different. Click ‘Save Changes‘

Confirm you are happy with the settings and click ‘Yes, proceed with import‘

As with the upload, the status stays at ‘Importing‘ for me indefinitely – just refresh (you’ll also get email updates when uploads, restores etc finish……which is neat if the content is huge)

Pop over to your workspace and check out the new channel. Note that in this case it’s still called ‘private-channel-one‘ because that was just the text string I used to name the channel, but it now has a neat hash tag next to it instead of padlock.

Huzzah, its now public!

If for some reason you are not happy with the result, your progress screen on the import section of Slack should give you the option to rollback. That will tear down anything it just did (as part of the import……it will not restore the private channel you deleted, as that was a different operation)!

You can play with the JSON content to rename the channel as you import (in case that ‘Delete this Channel’ is just too scary until the import is done).