Skip to content

Instantly share code, notes, and snippets.

@gsamat
Last active September 29, 2015 17:35
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gsamat/f9dd736b777f52dea396 to your computer and use it in GitHub Desktop.
Save gsamat/f9dd736b777f52dea396 to your computer and use it in GitHub Desktop.
slack private group to channel import
#!/bin/sh
# 0. create a channel you want to import to
# 1. first you get token and channel_id from slack's API page
# 2. then you run the script
# 3. while it is running, you export your team data, delete everything except one channels.json, users.json and one dir for you channel
# 4. then manually (sorry guys) craft json and put it into channel dir
# 5. make zip and upload it to import
# 6. profit
token=
channel_id=
link_first='https://slack.com/api/groups.history?token=$token\&channel=$channel_id\&pretty=1'
link_following='https://slack.com/api/groups.history?token=$token\&channel=$channel_id\&latest=$latest\&pretty=1'
current_file_no=1
echo hi
curl $(eval "echo $link_first") > export-$current_file_no.json
while grep -q '"has_more": true' export-$current_file_no.json;
do
latest=$(grep ts export-$current_file_no.json|tail -n 1|grep -o "\d*\.\d*"|tr -d '\n')
current_file_no=$((current_file_no+1))
curl -s $(eval "echo $link_following") > export-$current_file_no.json
done
@JTBrinkmann
Copy link

curl $(eval "echo $link_first")? wow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment