Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Enterprise slack instances? #273

Open
yarikoptic opened this issue Mar 1, 2024 · 11 comments
Open

Support for Enterprise slack instances? #273

yarikoptic opened this issue Mar 1, 2024 · 11 comments
Assignees
Labels
EDGE enhancement New feature or request
Milestone

Comments

@yarikoptic
Copy link
Contributor

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

Tried to auth against our dandiarchive instance which is on mit's enterprise slack instance.

after telling slackdump to dump list of conversations and going through authentication in a browser just getting

❯ ./slackdump -w dandiarchive
Slackdump dev (commit: placeholder) built on: 2077
authenticated.
2024/02/29 23:41:53 > checking user cache...
2024/02/29 23:41:53 retrieving data...
2024/02/29 23:41:53 application error: callback error: enterprise_is_restricted

Previously successfully fetched a list for another slack workspace on a "regular" slack instance

@rusq
Copy link
Owner

rusq commented Mar 6, 2024

Hey @yarikoptic, thanks for the suggestion! Right now it would prevent the export from working on the enterprise instances. I suspect, the workaround would be to "observe" the edge api and making a custom call to the edge APIs.

@rusq rusq added enhancement New feature or request EDGE labels Mar 6, 2024
@xiaket
Copy link

xiaket commented Mar 8, 2024

It looks like we have the code here, but it is not being actively used in the codebase.

@rusq
Copy link
Owner

rusq commented Mar 8, 2024

I even know who wrote it 😂 It's just a stray one from one of the experimental branches that I did not want to lose. Did not go far with it. It will need to be revised.

@rusq
Copy link
Owner

rusq commented Mar 19, 2024

Known restrictions:

1. error getting conversation users: callback error: enterprise_is_restricted
2. error getting members for [my test channel]: callback error: enterprise_is_restricted

@rusq
Copy link
Owner

rusq commented Mar 24, 2024

Experimented with this over the weekend - findings:

Slack does not allow to seek past Page 100, when page > 100 requested, Slack
returns the first page (Page=1). Seems to be an internal limitation. The
workaround would be to use the Query parameter, to be more specific about the
channel names, but to get all channels, this would require iterating through
all 65536 runes of unicode give or take the special characters.

I'll take a break from this, maybe some idea comes up.

@rusq rusq self-assigned this Mar 24, 2024
@rusq
Copy link
Owner

rusq commented Mar 30, 2024

Hey @yarikoptic , with the great help of a slackdump user in Telegram, we were able to get it going, you can check the "v3" branch.

git checkout v3

The only thing you need to do, is to use the -enteprise flag.

In the examples I will use the "record" format which is a new way to save the Workspace information implemented in v3. It is already quite stable, so the plan is for future versions to support it unchanged. I'll show how to convert to export further, please keep reading.

Exporting

To export full workspace (in the "chunk" format):

go run ./cmd/slackdump archive -enterprise

To export some conversations:

go run ./cmd/slackdump archive -enterprise CHANNEL_ID1 CHANNEL_ID2

This will create "slackdump_" directory. I will refer to it as "slackdump_record_dir" further in this message.

To get the chunk format spec:

go run ./cmd/slackdump help chunk

EXPERIMENTAL: viewing the archive

"View" allows to view the slackdump record archives, Slack and slackdump export ZIP files and directories, and Slackdump dump archives. It will detect the format automatically.

To view the archive, run:

go run ./cmd/slackdump view slackdump_record_dir

Then head to http://localhost:8080

Converting to Slack export format

If you wish for some reason to convert to slack export format, run this command:

go run ./cmd/slackdump convert -o my_export_file.zip slackdump_record_dir

Any feedback is welcomed.

@rusq
Copy link
Owner

rusq commented Mar 30, 2024

Getting help

Help is still in progress, but most of the commands will provide the flags and their description.

To get the list of commands:

go run ./cmd/slackdump help

To get help for the command or read a help topic:

go run ./cmd/slackdump help <topic or command>

To get help on a subcommand:

go run ./cmd/slackdump help command subcommand

for example

go run ./cmd/slackdump help list users

@rusq rusq added this to the v3.0.0 milestone Mar 30, 2024
@xiaket
Copy link

xiaket commented Apr 4, 2024

Thanks for your hard work on this @rusq ! Really appreciated it! I can confirm that it works on my side as well. I checked out v3 branch, ran make arm_darwin to generate a binary, then used ./arm_darwin workspace to login and ./arm_darwin dump -enterprise C0xxxxxx to dump all messages in a channel. I'd like to report that the record command is not found on my v3 checkout(ffd4532)

@rusq
Copy link
Owner

rusq commented Apr 4, 2024

Hey @xiaket, thank you for the feedback! Sorry about that, v3 is in heavy development, I have renamed "record" to "archive" to make the purpose more clear, I'll update my prev msg.

@hutchiko
Copy link

hutchiko commented May 6, 2024

@rusq I have also verified this works as advertised off the v3-wiz branch against my work enterprise Slack account. However I did have to make one small change as the Slack URL my workspace uses is not compatible with the current test. Ours is of the format:

https:///company.enterprise.slack.com/...

To get past this I updated the regexp used in url_parse.go to verify the URL to the following:

var slackURLRe = regexp.MustCompile(`^https:\/\/[a-zA-Z0-9]{1}[-\w]+(\.enterprise)?\.slack\.com\/archives\/[A-Z]{1}[A-Z0-9]+(\/p(\d+))?$`)

Thanks for all you work on this.

@rusq
Copy link
Owner

rusq commented May 6, 2024

Hey @hutchiko thanks for letting me know, I'll update the code and tests, when able! Glad that you were able to make it work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
EDGE enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants