Purpose: dump slack messages, users and files using browser token and cookie.

Slack Dumper

Purpose: dump slack messages, users and files using browser token and cookie.

Typical usecase scenarios:

  • You want to archive your private convesations from slack but the administrator does not allow you to install applications.
  • You are allowed to install applications in Slack but don't want to use the "cloud" tools for privacy concerns - god knows what those third party apps are retaining in their "clouds".

The library is "fit-for-purpose" quality and provided AS-IS. Can't say it's ready for production, as it lacks most of the unit tests, but will do for ad-hoc use.

Usage

  1. Download the archive from the Releases page for your operating system.
  2. Unpack
  3. Run slackdump -h to see help.

How to authenticate

Getting the authentication data

  1. Open up your Slack in browser and login.
TOKEN
  1. Open your browser Developer Console.
  2. Go to the Network tab
  3. In the toolbar, switch to Fetch/XHR view.
  4. Open any channel or private conversation in Slack. You'll see a bunch of stuff appearing in Network panel.
  5. In the list of requests, find the one starting with channels.prefs.get?, click it and click on Headers tab in the opened pane.
  6. Scroll down, until you see Form Data
  7. Grab the token: value (it starts with xoxc-), by right clicking the value and choosing "Copy Value".
COOKIE
  1. Switch to Application tab and select Cookies in the left navigation pane.
  2. Find the cookie with the name "d". That's right, just the letter "d".
  3. Double-click the Value of this cookie.
  4. Press Ctrl+C or Cmd+C to copy it's value to clipboard.
  5. Save it for later.

Setting up the application

  1. Create the file named .env next to where the slackdump executable in any text editor.

  2. Add the token and cookie values to it. End result should look like this:

    SLACK_TOKEN=xoxc-<...elided...>
    COOKIE=12345472908twp<...elided...>
    
  3. Save the file and close the editor.

Dumping conversations

Firstly, dump the channel list to choose what you want to dump:

slackdump -c

You will get the output resembling the following:

2021/10/31 17:32:34 initializing...
2021/10/31 17:32:35 retrieving data...
2021/10/31 17:32:35 done
ID           Arch  Saved  What
CHXXXXXXX    -     -      #everything
CHXXXXXXX    -     -      #everyone
CHXXXXXXX    -     -      #random
DHMAXXXXX    -     -      @slackbot
DNF3XXXXX    -     -      @alice
DLY4XXXXX    -     -      @bob

You'll need the value in the ID column.

To dump the channel, run the following command:

slackdump 
   [ID2] ... [IDn]

 

By default, slackdump generates a json file with the convesation. If you want the convesation to be saved to a text file as well, use the -r text command line parameter. See example below.

Example

Say, you want to dump convesations with @alice and @bob to the text files and also want to save all the files that you all shared in those convesations:

slackdump -r text -f DNF3XXXXX DLY4XXXXX
          ------- -- --------- ---------
             |     |    |         |
             |     |    |         +-: @alice
             |     |    +-----------: @bob
             |     +----------------: save files
             +----------------------: text file output

Dumping users

To view all users, run:

slackdump -u

As a library

Download:

go get github.com/rusq/slackdump

Use:

import "github.com/rusq/slackdump"

func main() {
  sd, err := slackdump.New(os.Getenv("TOKEN"), os.Getenv("COOKIE"))
  if err != nil {
      // handle
  }
  // ... read the docs
}

FAQ

Q: Do I need to create a Slack application?

A: No, you don't. You need to grab that token and cookie from the browser Slack session. See Usage in the top of the file.

Q: I'm getting ``invalid_auth``

A: Go get the new Cookie from the browser.

Owner
Rustam
Man Proposes, Cat Disposes
Rustam
Comments
  • Ignoring errors

    Ignoring errors

    Describe the bug while bugs are encountered, export process terminates To Reproduce Steps to reproduce the behavior:

    1. Run slackdump like this '...' slackdump -f -export MyDump @channelList.txt Expected behavior Continue or prompt if to ignore error. Output 2022/08/16 13:53:39 application error: export error: failed to dump "xyz" (xxx): callback error: failed to dump channel xxx: strconv.Atoi: parsing "null": invalid syntax

    Desktop (please complete the following information):

    • OS: [e.g. macOS] Windows Additional context Same problem occurs if there is temporary slack down time e.g. 503 error. For larger exports it may take time to process. It would be good to expose flags to ignore error and/or retry X times after Y time then ignore or exit. Now i need to forgo entire channel as it is failing. Also had to write script that compares continent if other channels fail (not fatally) and can be restarted later.

    Otherwise gj bro!

  • Mattermost export compatibility

    Mattermost export compatibility

    as per https://t.me/slackdump/185 investigate the format of Mattermost compatible export (the one that includes attachments). Tool name: slack-advanced-exporter

  • invalid_auth on some Slack workspaces

    invalid_auth on some Slack workspaces

    Describe the bug Using enterprise/paid version of Slack, after configuring a secrets.txt file, running slackdump -u, it is unable to download the users or anything else: 2022/03/16 20:19:25 > checking user cache... 2022/03/16 20:19:25 caching users for the first time 2022/03/16 20:19:25 error fetching users: couldn't fetch users

    verbose output from slackdump -v -u: 2022/03/16 20:22:22 slackdump.go:88: > checking user cache... 2022/03/16 20:22:22 users.go:37: caching users for the first time 2022/03/16 20:22:22 main.go:65: error fetching users: couldn't fetch users

    To Reproduce Steps to reproduce the behavior: When I used chrome to get the value of the authorization cookie, I did have to do URL decode so that it would appear as a base64 value. It does not appear that it is complaining about authorization.

    Expected behavior A clear and concise description of what you expected to happen. Expected it to list the users

    Output If applicable, add output to help explain your problem. Output is shown above.

    Desktop (please complete the following information):

    • OS: [e.g. macOS] Windows 11 using released binaries.

    Additional context Add any other context about the problem here.

  • Export max size limit?

    Export max size limit? "Bad magic number for file header"

    Describe the bug I am exporting a bunch of channels, DMs etc. The export finishes without errors. When I try to open the zip file created, I get this error.

    Windows cannot open the folder.
    The Compressed (zipped) Folder 'C:\Data\SlackDump\my-workspace.zip' is invalid.
    

    Other software gives the error in the title.

    One thing I have noticed is that the zip is roughly 1 GB in size in size, hence the question on size limits.

    I have not had the issue with exporting a couple of channels and DMs where the size was much smaller.

    To Reproduce Steps to reproduce the behavior:

    1. .\slackdump.exe -export my-workspace.zip -download -user-cache-age 96h0m0s -user-cache-file u.cache G02*** D02*** C02*** ...

    Expected behavior Usable export file. Using the suggested slack-export-viewer works with smaller size archive.

    Output The output reports completion but curiously logs an additional save afterwards.

    2022/07/18 14:11:27   thread fetch complete, total: 6
    2022/07/18 14:11:27 messages request #    3, fetched:   31 (threads: 14, files: 8), total:      431 (speed:   2.22/sec, avg:   2.54/sec)
    2022/07/18 14:11:27 messages fetch complete, total: 431
    2022/07/18 14:11:33 completed, time taken: 26m30.7357232s
    2022/07/18 14:11:33 file "F02***-image.png" saved to abcd\attachments: 24999 bytes written
    

    Desktop (please complete the following information):

    • OS: Windows 11 22H2 (OS Build 22622.290)

    Running

    PS C:\Data\SlackDump> .\slackdump.exe -V
    Slackdump v2.0.1 Copyright (c) 2018-2022 rusq (build: 1c46ed8)
    
    v2.0.1
    

    Ran a smaller export with the trace option.

    2022/07/18 14:42:57   thread fetch complete, total: 2
    2022/07/18 14:42:58   thread request #    1, fetched:    4, total:        4, process results:  (speed:  10.67/sec, avg:  10.67/sec)
    2022/07/18 14:42:58   thread fetch complete, total: 4
    2022/07/18 14:42:58 messages request #    1, fetched:   43 (threads: 10, files: 14), total:       43 (speed:  11.80/sec, avg:  11.80/sec)
    2022/07/18 14:42:58 messages fetch complete, total: 43
    2022/07/18 14:43:04 completed, time taken: 24.2782739s
    2022/07/18 14:43:04 error saving "F0***K-Access for abcd.docx" to cba\attachments: write my-workspace2.zip: file already closed
    2022/07/18 14:43:04 error saving "F0***W-image.png" to cba\attachments: write my-workspace2.zip: file already closed
    2022/07/18 14:43:04 error saving "F0***7-image.png" to cba\attachments: write my-workspace2.zip: file already closed
    2022/07/18 14:43:04 error saving "F0***Y-image.png" to cba\attachments: context canceled
    2022/07/18 14:43:04 error saving "F0***A-image.png" to cba\attachments: write my-workspace2.zip: file already closed
    2022/07/18 14:43:04 error saving "F0***9-Untitled.js" to cba\attachments: context canceled
    PS C:\Data\SlackDump> dir
    
  • Slack-export compatibility

    Slack-export compatibility

    v2.0.0-rc

    Also, it is expected that attachment won't be imported. When one creates an export using the Slack workspace export, what happens is 1) Slack generates a special "export token" 2) all export json conversation files links are updated to include this token in the URL. So the files are still hosted on slack and not physically downloaded into the ZIP archive generated by slack. I suspect, that when one imports the conversations, Slack tries to access those links to remap the files to the new workspace. Potentially the solution would be to start a web server that Slack can see, update all file links in conversations to this sever address to let the new Slack workspace download it, if that was happens, but this is just my guess

  • how to export a specific thread?

    how to export a specific thread?

    I came across this great tool, but I am a bit puzzled as to how to export/dump a specific thread. Channels can be extremly large and I am intersted in a specific thread. How can I export that thread alone?

    In an org with 2000 channels slackdump -c would not give me a specific thread id, or at least I probably won't find it in there. When I copy a link to a thread in Slack, I get 2 ids in the link. Can I use that info to dump a specific thread? If yes, how?

  • Internal Server Error when exporting a very large thread (800+ messages)

    Internal Server Error when exporting a very large thread (800+ messages)

    Describe the bug I'm trying to export a thread with more than 800 messages (as of today) but I get an error when I run the following command: ./slackdump -r text https://xyz.slack.com/archives/RK9N4AFRB/p165158407

    This thread mostly contains images, some text messages, some links, standard/custom emojis/reactions.

    I can export smaller threads (fewer than 5 messages) that are either older or newer from the same private channel without any problem.

    I'm using version 1.3.5.

    Output

    2022/05/05 13:31:54 > checking user cache...
    2022/05/05 13:32:07 error processing: "https://xyz.slack.com/archives/RK9N4AFRB/p165158407" (conversation will be skipped): slack server error: 500 Internal Server Error
    2022/05/05 13:32:07 job finished, dumped 0 item(s)
    

    Desktop (please complete the following information):

    • OS: Windows 10
  • Google refuses login with Google Auth from built-in Chromium or Firefox

    Google refuses login with Google Auth from built-in Chromium or Firefox

    Describe the bug After entering the name of the workspace, the browser is opened. In this (built-in) Chromium browser, I can select the method of logging in, which in my case is with a Google account. After entering the mail address I get a message that this browser or app is not secure. Like in https://support.google.com/accounts/thread/22873505?msgid=24501976

    To Reproduce Steps to reproduce the behavior:

    1. Run slackdump
    2. Answer the questions
    3. In the browser which is opened, try logging in with a google account

    Expected behavior I expect to be able to log in, maybe by selecting a browser or using the systems default browser?

    Desktop (please complete the following information):

    • OS: Windows 10
    • Browsers Available: Google Chrome, Firefox

    Additional context I have not been able to test with any other method of authenticating, I assume this all works identically

  • Dump custom emojis

    Dump custom emojis

    Since custom emojis are an important aspect of Slack instance culture/comms, perhaps it makes sense for SlackDump to also dump custom emojis (e.g. via a new flag/arg/param to slackdump).

    https://github.com/jason0x43/alfred-slack/blob/master/emoji.go provides one examples of leveraging the appropriate Slack API: https://api.slack.com/methods/emoji.list.

    Thank you for considering!

  • I am using the IDs to export the chat. But the response is always the channel does not exist.

    I am using the IDs to export the chat. But the response is always the channel does not exist.

    Describe the bug A clear and concise description of what the bug is.

    To Reproduce Steps to reproduce the behavior:

    1. Go to '...'
    2. Click on '....'
    3. Scroll down to '....'
    4. See error

    Expected behavior A clear and concise description of what you expected to happen.

    Screenshots If applicable, add screenshots to help explain your problem.

    Desktop (please complete the following information):

    • OS: [e.g. iOS]
    • Browser [e.g. chrome, safari]
    • Version [e.g. 22]

    Smartphone (please complete the following information):

    • Device: [e.g. iPhone6]
    • OS: [e.g. iOS8.1]
    • Browser [e.g. stock browser, safari]
    • Version [e.g. 22]

    Additional context Add any other context about the problem here.

  • slack rate limit exceeded (again)

    slack rate limit exceeded (again)

    I'm seeing a similar problem to #1 when I try to download a single channel (it manages to get 820 files, then stops with the message "slack rate limit exceeded, retry after 1s"). Would it be possible to provide a command-line argument for adjusting the rate of requests? I got this error on linux, then tried downloading the latest Windows build in the hopes that the extra delay imposed by my VPN connection might help (it didn't).

    Originally posted by @shi-bmz in https://github.com/rusq/slackdump/issues/1#issuecomment-1019478033

  • Resume-from-failed functionality

    Resume-from-failed functionality

      After 17GB of export, my slackdump process died with a 500 response from Slack.  I'd love to be able to start again where it left off.  It was a 500 error, so hopefully it was resolved on their end (and not due to bad data etc). 
    
    2022/12/06 21:32:28 application error: export error: channels: error: failed to dump "dataeng-alerts-high" (CM0BW29LZ): callback error: failed to dump channel:thread CM0BW29LZ:1575031520.121400: slack server error: 500 Internal Server Error
    

    Being able to resume where it died would be huge for someone trying to get a complete workspace export. And it's probably as easy as enumerating everything (into a file) on process start, and removing lines from the file as tasks get completed. On start up, it can see if this file already exists and start with the next line as the first task.

    Thoughts?

    edit: Thinking about it a bit more - an "if this file already exists, skip it" check before exporting a channel/thread/file might help speed things up dramatically and accomplish almost the same thing. Hmm

    Originally posted by @jjcovert in https://github.com/rusq/slackdump/discussions/172

  • Use goreleaser to release to github/nfpms/homebrew(as tap)

    Use goreleaser to release to github/nfpms/homebrew(as tap)

    Is your feature request related to a problem? Please describe.

    Releases are currently managed using wangyoucao577/go-release-action via a github workflow. This can be replaced with goreleaser providing the following

    #### Homebrew
    
    For macOS, a [homebrew](https://brew.sh) tap is provided:
    
        brew install rusq/tap/slackdump
    
    • Optionally nfpms can be used in goreleaser to generate a .deb/.rpm to ease installation on linux distributions as well.

    Describe the solution you'd like

    • Replace the use of wangyoucao577/go-release-actionwith a new simplified workflow that calls goreleaser to build and release on merges to both github and homebrew.
    • Add the required .goreleaser.yml to the root of the project to provide goreleaser workflow the proper configuration to perform the releases initially just homebrew and github release.
    • Create a separate repo for the homebrew-tap formula which goreleaser will publish to. ie: rusq/homebrew-tap this will translate to the following brew install command brew install rusq/tap/slackdump
    • Update README to provide homebrew tap installation instructions. brew install rusq/tap/slackdump Describe alternatives you've considered
    • Submit the formula as a release to the official homebrew-core tap and manage PRs for updates via that channel. This requires more work and a PR each time a version is updated to the homebrew repo.
  • Support CSV or Text format for Slack Import Tool

    Support CSV or Text format for Slack Import Tool

    Awesome tool. I've exported to both json and txt and am now trying to reimport conversations into a new slack workspace but getting various errors (like, format not supported for txt). I know importing via json is not supported. For reference, I am trying to follow these guidelines: https://slack.com/help/articles/360035354694-Move-data-to-Slack-using-a-CSV-or-text-file.

    I believe I have to reformat the txt file to make it importable. Apologies in advance if there's an easy way to do this and I'm missing something simple.

    I've spoken with slack support and they recommended reaching out to the slack dump community.

    Thanks so much in advance.

    Originally posted by @BwL1289 in https://github.com/rusq/slackdump/discussions/165

  • Create the slackdump brew formula for macOS

    Create the slackdump brew formula for macOS

    It would be convenient to install Slackdump using brew command, i.e.:

    brew install slackdump
    

    Create a brew formula.

    I'd greatly appreciate if someone could help me with this.

  • Switch to commands instead of flags

    Switch to commands instead of flags

    There's a repelling amount of command line flags right now, it would make sense to implement the major modes, such as:

    • export
    • list
    • dump (standard)
    • etc.

    As separate commands.

    For example, current invocation for export is:

    slackdump -export foo.zip -export-type mattermost -download
    

    would be

    slackdump export -type mattermost -download foo.zip 
    

    Alternatively, as suggested in #121 could you the https://github.com/spf13/cobra library

  • Fetching only starred and/or reacted items

    Fetching only starred and/or reacted items

    Is your feature request related to a problem? Please describe. Some people organise their information using stars and reactions. Currently there's no way to get only the starred and/or reacted items, and this might be a problem on a large workspaces, when the only choice would be to manually assemble the list of items to download, or download the large workspace in full.

    Describe the solution you'd like Implement the ability to export only starred and/or reacted items (messages, replies, attachments)

    Describe alternatives you've considered Getting with curl and assembling list manually.

    Additional context Fork from #109

mmdb-dump-networks - print every network in an MMDB to STDOUT

mmdb-dump-networks mmdb-dump-networks - print every network in an MMDB to STDOUT Project Description Usage Description Installation Reporting Bugs and

Oct 19, 2021
GoDumpLsass is a simple tool that can dump lsass without to get caught by Windows Defender.

GoDumpLsass GoDumpLsass is a simple tool that can dump lsass without to get caught by Windows Defender. Releases https://github.com/Enelg52/GoDumpLsas

Nov 4, 2022
Dump parking ticket metadata from paymycite.com
Dump parking ticket metadata from paymycite.com

paymycite-dump I got a parking ticket in Sonoma County, so naturally I am now dumping a large random sample of real parking citations from their onlin

Jan 4, 2022
A tool to quickly dump notes, todos, snippets, ...

brain_dump brain_dump allows to quickly dump notes, todos, snippets, ... in text files using Golang text/template and functions from the Sprig project

Feb 21, 2022
Dump all destinations of a split.to link

Split Dumper Dump all destinations of a split.to link Split Dumper Utility

Jul 11, 2022
Using JWT to authenticate the users of an web-application
Using JWT to authenticate the users of an web-application

Checkpoint Using JWT to authenticate the users of a web-application. Routes /api

Oct 2, 2022
Typo/error resilient, human-readable token generator

toktok A human-friendly token generator Creates tokens which avoid characters that can be easily misinterpreted, like '1' and 'I' or '8' and 'B', as w

Sep 16, 2022
Get the long-term token for the Budget Insight API (sandbox)

token-budget-insight This small tool aims to automate the creation of the long-term token for a Budget Insight application; the process is explain in

Jan 7, 2022
A general-purpose Cadence contract for trading NFTs on Flow

NFT Storefront The NFT storefront is a general-purpose Cadence contract for trading NFTs on Flow. NFTStorefront uses modern Cadence run-time type faci

Dec 24, 2022
A basic golang package for demonstration purpose.

stringutils A basic golang package for demonstration purpose. Package currently contains only one function: func Reverse(s string) string Installation

Nov 30, 2021
Monitor star changes of GitHub repo, and send the notification to slack or lark.

stargazers Features monitor the star events of the GitHub repo send the notifications to Slack or Lark How to use For Lark, create a bot called like s

Dec 4, 2022
Alfred 4 workflow to easily search and launch bookmarks from the Brave Browser

Alfred Brave Browser Bookmarks A simple and fast workflow for searching and launching Brave Browser bookmarks. Why this workflow? No python dependency

Nov 28, 2022
GoLang Library for Browser Capabilities Project

Browser Capabilities GoLang Project PHP has get_browser() function which tells what the user's browser is capable of. You can check original documenta

Sep 27, 2022
Host yo' self from your browser, your phone, your toaster.
Host yo' self from your browser, your phone, your toaster.

A hosting service from the browser, because why not. Try it at hostyoself.com. See it in action Here's an example where I use hostyoself.com to host i

Jan 1, 2023
Shows your recent browser history in tree style. 树状展示浏览器历史 (For Edge / Chromium / Chrome)
Shows your recent browser history in tree style. 树状展示浏览器历史  (For Edge / Chromium / Chrome)

Tree Style Histyle This extension shows your recent browser history in tree style. When you browser pages from internet, you always jump from one page

Jan 3, 2023
An OBS overlay (browser source) for mumble

Mumble UI An attempt at creating an overlay that could be used inside of OBS to show who is speaking for the DAY[0] Podcast. It is meant to be reasona

Jan 27, 2022
GoLang Library for Browser Capabilities Project

Browser Capabilities GoLang Project PHP has get_browser() function which tells what the user's browser is capable of. You can check original documenta

Nov 23, 2021
Quickly clone an entire org/users repositories into one directory - Supports GitHub, GitLab, Bitbucket, and more
Quickly clone an entire org/users repositories into one directory - Supports GitHub, GitLab, Bitbucket, and more

ghorg ghorg allows you to quickly clone all of an orgs, or users repos into a single directory. This can be useful in many situations including Search

Jan 1, 2023
Casbin-forum is the official forum for Casbin developers and users.

Casbin-forum is the official forum for Casbin developers and users. Link https://forum.casbin.com/ Architecture Casbin-forum contains 2 p

Jan 3, 2023