Last active
September 29, 2015 17:35
-
-
Save gsamat/f9dd736b777f52dea396 to your computer and use it in GitHub Desktop.
slack private group to channel import
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
curl $(eval "echo $link_first")
? wow