Last active
May 2, 2019 23:39
-
-
Save sagotsky/ff823ae2ef86bb79dd87933e53edda8d to your computer and use it in GitHub Desktop.
slack history exporter. override the three vars at the top. run the script for api token and dependency instructions. channels are public and have a # icon. private groups are private and have a lock icon.
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/bash | |
| PRIVATE_GROUPS="thepit" | |
| CHANNELS="avatar plm_website general health_insurance vim" | |
| USERS="awilkie amonat bryanalves brittneysaint" | |
| if [[ "$SLACK_TOKEN" == '' ]] ; then | |
| echo 'Visit https://api.slack.com/custom-integrations/legacy-tokens to make yourself a slack token' | |
| echo 'Set it with `export SLACK_TOKEN=abc123...`' | |
| echo 'Then rerun this script' | |
| exit 1 | |
| fi | |
| which slack-history-export &>/dev/null || (echo "Install slack-history-export from npm" && exit 1) | |
| mkdir -p slack_history | |
| for chan in $CHANNELS ; do | |
| echo $chan | |
| slack-history-export --type group --token $SLACK_TOKEN -c $chan > "slack_history/$chan.json" | |
| sleep 3 | |
| done | |
| for group in $PRIVATE_GROUPS ; do | |
| echo $group | |
| slack-history-export --type group --token $SLACK_TOKEN -g $group > "slack_history/$group.json" | |
| sleep 3 | |
| done | |
| for user in $USERS ; do | |
| echo $user | |
| slack-history-export --type dm --token $SLACK_TOKEN -u $user > "slack_history/$user.json" | |
| sleep 3 | |
| done | |
| ls -Rlh slack_history/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment