hisabimbola / slack-history-export

A NPM module that allows slack users export their history
MIT License
287 stars 45 forks source link

JSON output stores user.id rather than user.name #31

Open JoshuaMontgomery opened 7 years ago

JoshuaMontgomery commented 7 years ago

It would be great if the output json files could store the user field in the json as a user.id rather than user.name, where the matching is already in the users.json file. This would make it compatible with all of the applications designed to display official slack export files.

Current message structure:

    {
        "type": "message",
        "user": "myrealname",
        "text": "Hello World!",
        "ts": "1475643100.000002",
        "date": 1475643100000
    }

Proposed optional message structure:

    {
        "type": "message",
        "user": "U1TM6AX5M",
        "text": "Hello World!",
        "ts": "1475643100.000002",
        "date": 1475643100000
    }

In particular, this would allow your tool to be used in conjunction with the slack-export-viewer tool and preserve things like avatar pictures.

By the way, thanks! This is a great tool.

graywolf336 commented 7 years ago

Agreed, this would be extremely helpful as we have had a few people request private group import from Slack into Rocket.Chat and the limiting factor of them using this tool is the user's username is used and not their user id.

tomsherman commented 7 years ago

@graywolf336 I wrote an npm module called slack-message-archiver and ran into the same issues. It's a bit hacky but what I did was to use the Slack API to get a list of users (usernames + user ids) and then did some regexes on the text of the output of slack-history-export. See code here. Hope that helps.

JoshuaMontgomery commented 7 years ago

Hi @tomsherman, you came to a similar solution as me, though more self-contained and less hacky. I ended up using two different tools, and the users.json file you can request from the slack API as well. It works well, except for sub-mentions, which are still not converted.

https://github.com/SouthPoleTelescope/slacklogging