hisabimbola / slack-history-export

A NPM module that allows slack users export their history

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

appears csv option not working

wwp3 opened this issue · comments

Generates an empty CSV file locally and seems to get stuck in an infinite loop (CLI displays 'working...')

Hi @wwp3 please provide the query you ran that made the tool run into a loop and an empty CSV

Hi @hisabimbola - an example query is as follows:

slack-history-export -t "slack-token-here" -c channel -F csv

or

slack-history-export -t "slack-history-here" -u user -F csv

FWIW - queries outputting json seem to work fine.

Haven't had time to dig into it, but assume something is getting caught in the json2csv loop. Perhaps the json output from the Slack API is not entirely flattened/outlined to extract data to csv? Or maybe it the data structure has changed slightly from when the script was initially written?

I have an idea what the cause could be, will look into it and fix it ASAP.

Thanks for flagging.

While fixing this, I will be using the official slack format to structure the layout of the CSV.

We can import just about any delimited text file from just about any source, as long as it adheres to the following rules:

Each row is a new message.
There are separate columns for: timestamp (unix timestamp), channel, username, text (in that order).
Everything is in a single, uncompressed file.
Messages must be sorted by timestamps (earlier first).
You're okay with us escaping any HTML you had, aside from links.
Multi-line messages can be represented by raw newlines in the file, as long as the text is enclosed in ".
As a reference, the file should contain lines that look like this:
"1357559471","random","myles","Anyone want to hear a "joke"?"
"1357559472","random","myles","Valid responses are:
Yes, of course
Why bother even asking?"