slack-history-export icon indicating copy to clipboard operation
slack-history-export copied to clipboard

JSON output stores user.id rather than user.name

Open JoshuaMontgomery opened this issue 7 years ago • 3 comments

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.

JoshuaMontgomery avatar Oct 12 '16 20:10 JoshuaMontgomery

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.

graywolf336 avatar Nov 18 '16 18:11 graywolf336

@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.

tomsherman avatar Jan 03 '17 03:01 tomsherman

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

JoshuaMontgomery avatar Jan 03 '17 07:01 JoshuaMontgomery