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

Overview

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.

Issues
  • 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.

    help wanted 
    opened by dzehme 15
  • 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

    opened by rusq 13
  • 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?

    enhancement 
    opened by tessus 13
  • 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
    opened by pican79 11
  • 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.

    opened by Julgme 8
  • 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

    opened by shi-bmz 8
  • `go install` gets error

    `go install` gets error

    Describe the bug I am trying to make use of this package as a library, and installing produces an error

    ../../../../pkg/mod/github.com/rusq/slackdump/[email protected]/slackdump.go:95:51: undefined: slack.OptionCookieRAW
    

    To Reproduce

    1. go install / go build

    Expected behavior Successful install

    Desktop (please complete the following information):

    • OS: macOS monterey
    documentation 
    opened by shotesmagotes 6
  • Threads in text output, not just JSON output

    Threads in text output, not just JSON output

    Hi @rusq.

    I can confirm that the original JSON output does, in fact, contain expected thread content (e.g. the "slackdump_thread_replies" array). Unfortunately, the associated text output does not.

    When is support planned for text output? Thank you

    Originally posted by @craigrandall in https://github.com/rusq/slackdump/issues/2#issuecomment-1020363214

    enhancement 
    opened by craigrandall 3
  • Dump threads

    Dump threads

    opened by tuftik 3
  • Program won't open on Windows

    Program won't open on Windows

    Describe the bug When I try to run slackdump.exe, a window opens and then immediately disappears.

    To Reproduce I open the file.

    Expected behavior I expect the program to open and run but there seems to be a compatibility issue that the windows compatibility wizard can't identify.

    Desktop (please complete the following information):

    • OS: Windows

    Additional context Sorry, I know this is probably too vague and submitted in the wrong place, but I would love to use this tool and have no idea how to resolve this issue. Thank you.

    opened by alexmayberry 2
  • Specify oldest and latest timestamps for dumping

    Specify oldest and latest timestamps for dumping

    Fantastic effort, very stable in the way it runs, robust (no crashes etc). In terms of features, is there a way to run this for specific dates? Eg just one day? (Unfortunately, I am only a user, so I can help with testing it and suggesting features)

    Originally posted by @mayookhl in https://github.com/rusq/slackdump/discussions/16#discussioncomment-2212455

    opened by rusq 2
  • Presence

    Presence

    The second request is to get only active users (where presence:active in results or the user IDs are in the presence_active_ids list). It would be super awesome if the request to users/list had a “filter” for it, but I haven’t found the magic keyword There is a “filter” keyword to the request. Initially it’s “people”. And when they use users/search, the filter gets more complex, “people AND NOT deactivated AND NOT external”

    enhancement 
    opened by rusq 0
  • User list does not include custom fields

    User list does not include custom fields

    Describe the bug

    The command slackdump -v -list-users -r json does not include the custom fields in user profiles.

    For example, a request of the form https://SUBDOMAIN.slack.com/api/search.modules?_x_id=1111111-11111111.551&_x_csid=2222-33333&slack_route=12345678&_x_version_ts=ABCDEFGH&_x_gantry=true&fp=7d

    returns profile data in the form

    {
        "iid": "33332999-7520-4444-9a6a-43fee1d42caa",
        "id": "UDJMAGZZZ",
        "profile": {
            "title": null,
            "phone": null,
            "skype": "",
            "real_name": "Jon Doe",
            "real_name_normalized": "Jon Doe",
            "display_name": "jon.doe",
            "display_name_normalized": "jon.doe",
            "fields": {
                "Zz11HKQG22": {
                    "value": "role",
                    "alt": ""
                },
                "Zz11KKCF22": {
                    "value": "2018-10-22",
                    "alt": ""
                },
                "Zz11JK4P22": {
                    "value": "location",
                    "alt": ""
                },
                "Zz11JKQ722": {
                    "value": "https:\/\/example.com\/people\/343000",
                    "alt": "text"
                },
                "Zz113KK222": {
                    "value": "U4GGSS333",
                    "alt": ""
                },
                "Zz11BKG822": {
                    "value": "function",
                    "alt": ""
                },
                "Zz118KA022": {
                    "value": "project name",
                    "alt": ""
                },
                "Zz115KTT22CB": {
                    "value": "747578",
                    "alt": ""
                }
            },
            "status_text": "",
            "status_emoji": "",
            "status_emoji_display_info": [],
            "status_expiration": 0,
            "avatar_hash": "cccccccccc",
            "image_original": "https:\/\/avatars.slack-edge.com\/2022-02-12\/abcdefgh-7b6_original.jpg",
            "is_custom_image": true,
            "email": "[email protected]",
            "first_name": "Jon",
            "last_name": "Doe",
            "image_24": "https:\/\/avatars.slack-edge.com\/2022-02-12\/abcdefgh-7b6_24.jpg",
            "image_32": "https:\/\/avatars.slack-edge.com\/2022-02-12\/abcdefgh-7b6_32.jpg",
            "image_48": "https:\/\/avatars.slack-edge.com\/2022-02-12\/abcdefgh-7b6_48.jpg",
            "image_72": "https:\/\/avatars.slack-edge.com\/2022-02-12\/abcdefgh-7b6_72.jpg",
            "image_192": "https:\/\/avatars.slack-edge.com\/2022-02-12\/abcdefgh-7b6_192.jpg",
            "image_512": "https:\/\/avatars.slack-edge.com\/2022-02-12\/abcdefgh-7b6_512.jpg",
            "image_1024": "https:\/\/avatars.slack-edge.com\/2022-02-12\/abcdefgh-7b6_1024.jpg",
            "status_text_canonical": "",
            "team": "TTTTTTT"
        },
        "username": "jon.doe",
        "is_restricted": null,
        "is_ultra_restricted": null,
        "phone": "",
        "top_terms": false,
        "similar": false
    }
    

    The key fields is not present in the output of slackdump -v -list-users -r json.

    Is there a way to have those fields included? What would need to be changed in the code in order to get that data?

    enhancement 
    opened by glowinthedark 1
  • 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!

    enhancement 
    opened by craigrandall 0
Releases(v2.0.0)
Owner
Rustam
Man Proposes, Cat Disposes
Rustam
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

Patrick Cronin 1 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

null 5 May 24, 2022
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

Alex Nichol 1 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

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

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

Thunder33345 1 Apr 16, 2022
Using JWT to authenticate the users of an web-application

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

AmirH.Najafizadeh 4 Jan 22, 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

Christian Muehlhaeuser 65 Mar 13, 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

Enguerrand Allamel 0 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

Flow 74 Jun 7, 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

Mert Kimyonşen 0 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

Kevin Wan 11 May 31, 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

Josh Newman 5 Apr 17, 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

Maksim N. 40 Jun 13, 2022
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

Zack 1.7k Jun 28, 2022
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

null 122 Jun 20, 2022
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

DAY[0] 1 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

Star Inc. 0 Nov 23, 2021
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

Jay Gabriels 942 Jun 28, 2022
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

Casbin 727 Jun 28, 2022