Ha.nnes.dev
Slack Archiver
đď¸
A tool to archive Slack links
2023-07-02
A tool to scan files containing Slack links, then archive the conversations in those links to a GitHub repository and replace the Slack links with links to the archives.
Setup
GitHub Token
- Generate a GitHub token, select âclassic tokenâ and tick the ârepoâ scope, then generate the token.
- Copy the token and paste into a
.env
file, with the nameGITHUB_TOKEN=...
Slack Token
- Create a new Slack app and choose âfrom an app manifestâ.
- After choosing the workspace, copy and paste the contents of
./app-manifest.json
- Open your Slack appâs basic information page, and press âInstall your appâ, then allow the app to access information.
- Select âOAuth & Permissionsâ from the appâs sidebar and copy the
User OAuth token for your workspace, paste it into a
.env
file with the nameSLACK_TOKEN=...
Configuration
Configuration is specified in a config.toml
file, the
fields are:
github_username
- the owner of the repo being used for archivinggithub_repo_name
- the name of the repo being used for archivinggit_name
- the name that will be associated with the git commitsgit_email
- the email that will be associated with the git commitsslack_workspace
- the name of your Slack workspace, e.g.Âjulialang
github_token_environment_variable
andslack_token_environment_variable
- optional, the names of the environment variables that will be checked for your tokens, default toGITHUB_TOKEN
andSLACK_TOKEN
respectively
Running
Install the projectâs dependencies:
julia --project=. -e 'import Pkg; Pkg.instantiate()'
Then run the src/SlackArchiver.jl
file, passing the
paths to files containing Slack links that you want archived. The files
will automatically be overwritten with ones containing the new archived
links.
julia --project=. src/SlackArchiver.jl ./path-to/my-file.md ./path-to/another-file.md