-
-
Notifications
You must be signed in to change notification settings - Fork 78
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
Mattermost export compatibility #107
Comments
Hi, I'm in the middle of testing slack advanced exporter. In particular, I'm trying to supply emails and attachments to the Slackdump export. It seems that the emails can be correctly fetched yet the attachments are not downloaded properly. Test 1: Test 2: By skimming through the file structure I'm not sure what causes the difference. Edit: It seems my test 1 is consistent with the result in #105 but not sure test 2 was done there. |
Here's a clue. There's some difference when Official export:
Slackdump export:
Note that "url_private" and "url_private_download" are different as Slackdump doesn't contain what I assume is the token (the It seems that it's exactly either "url_private" or "url_private_download" is the go-to address To back it up:
I'm not familiar enough with the token system so not sure how to fix it elegantly other than hard coding my token into the |
Hey @ChenSun-Phys thanks for your investigation, it seems you solved it. When I was running the Slack Export (when implementing export function), I noticed the following:
I think the first option in this case would be to provide an additional parameter that allows one to specify some token (xoxe, or xoxp etc.), that makes the file available for download externally. The second option - to generate the export file with |
Thanks for the comment @rusq . I realized that the token was generated during the export on Slack.com. This is displayed on the page where the export can be downloaded.
For now, I just wrote a short python script to replace the token to the |
For my slack channel it seems like work with no problem with the slackdump's export data with slack advanced exporter with emails and attachment. Is it take time to implement to export with API Token? seems like the authentication can pass a token args, but even I pass a token to it it still ask for browser login. |
I was planning to do it yesterday, but quite busy moving house, most likely I will look at it closer to the end of next week. @ChenSun-Phys has mentioned that had made a python program that updates the JSON data in the message json - maybe if he could consider committing it to "examples" of this repo, or share it some way otherwise, it would be a quick solution for your problem. |
Here's my quick dirty fix. I'm attaching my regex script below. I used it to migrate from Slack to Mattermost with success. Feel free to ping me about possible issues if you're in a similar transition process, be it related to this token issue or not.
|
Thank you for the script.I would like to take a look with it. I have made an exporter with python by using the API Token with full access permission. Should I make a PR to put this script in the |
Awesome the script looks good, although I haven't got time to test it carefully. Adding it through a PR sounds like a good idea. |
Another thought is that perhaps it's easier to get away with the token requirement for downloading the attachment altogether. This is based on the observastion that if I take the "url_private_download" or "url_private" value without the token, I could download it if I previously have already logged into the workspace in the same browser. Since I've done the latter three-step export many times by now with great success but I'm not happy with it. :-) Besides the added elegance in the one-step solution, it addresses a burning issue that I have in a few of my workspaces: generating the token by hand (i.e. step 1) requires at least admin privilege. Even though I have access to all the attachments in the first place, the |
@ChenSun-Phys I agree, that would be the best approach. I ran the slack-advanced-exporter, and examined the structure, tomorrow I'll have some time to start working on this. |
Hey @ChenSun-Phys , i have implemented the mattermost export format support in the https://github.com/rusq/slackdump/tree/i107-mattermost branch
|
@luvwinnie would this address your problem of having an API token in the export? Was the attachments the only reason for having the API token? |
I was able to setup mattermost instance locally and tested, it seems to work, but requires the use of mmetl, still too many steps. |
@rusq sorry for late reply, I'm busying on working other projects,I would like to test later. One more things is that maybe you can try to use the following command to import to mattermost.
|
@luvwinnie no worries at all. Thank you for the suggestion - I tried it too, when following the documentation, it does require the token, so now I do understand the need for this. But interestingly, it couldn't import attachments even with official export. Maybe that was some shenanigans of my docker instance, i'll have to mess around with it more. |
Sorry for being late to the party. A few Q's/comments
|
That's alright :)
./mmetl transform slack -t slackdump -d bulk-export-attachments -f test.zip -o mattermost_import.jsonl
# this seemed like a workaround step for the issue that you've linked
mkdir data
mv bulk-export-attachments data
7z a bulk.zip data mattermost_import.jsonl
mmctl import upload bulk.zip
mmctl import process dx9bg37wgty4pb14hywywde3rh_bulk.zip
# then mmctl import job list to ensure that it completes. I haven't run into the aforementioned issue, and all images were uploaded. The only issue I had is that my email in the export was the same I used for mattermost account, so it complained, had to edit the |
Thanks for the follow-up! Indeed, I also saw that the imported accounts cannot have the same email address that's already in mattermost. Just to be sure, do you still need to generate and add the xoxe token to the export by |
No problem :)
No, there's no need for xoxe token, and there's no need to run So the high level steps would be:
There is also a highly experimental branch i107-mattermost-mmetl, it reduces the steps to
The drawback for this is that it uses the packages from mattermost repo and it pulls LOTS of dependencies. The executable size increases dramatically, if compiled with |
Binaries available https://github.com/rusq/slackdump/releases/tag/v2.1.2 it's still alpha as there's no unit tests, only manually tested - releasing for the sake of speed. I have also updated the doc, adding a quick guide for mattermost migration |
@luvwinnie I've been experimenting with
The same file imported with |
I haven't tried |
Out of interest, as doc mentions it and @luvwinnie pointed to it as well. It seemed like one step of running |
@ChenSun-Phys I'll close this as this has been merged, let me know if there are issues, and we can revisit this. |
Sorry for the slow response. I just tested this in v2.2.0-alpha. It works like a charm. Thanks a lot! |
as per https://t.me/slackdump/185 investigate the format of Mattermost compatible export (the one that includes attachments). Tool name: slack-advanced-exporter
The text was updated successfully, but these errors were encountered: