slackdump icon indicating copy to clipboard operation
slackdump copied to clipboard

Add support for exporting own messages only from timeframe

Open razvanphp opened this issue 1 year ago • 8 comments

My usecase is rather interesting, but maybe also useful for other freelancers.

I want to be able to export all my messages from last month so I can calculate my hourly timesheet for invoicing.

I can easily select them in search, by choosing from:me and filter:range but pagination is awful and I can't programatically work on the dates and hours.

Thank you! R

razvanphp avatar Jan 11 '24 20:01 razvanphp

Seems like /api/search.modules.messages endpoint has this functionality, can we use it already with arbitrary parameters/query?

Screenshot 2024-01-11 at 23 00 18

razvanphp avatar Jan 11 '24 21:01 razvanphp

Hey @razvanphp, thank you for the suggestion. I think once I get the v3 out, this would be a great feature to have, I'll add it in v3.1 milestone.

rusq avatar Jan 11 '24 23:01 rusq

Added in v3.0.0

You can try it by checking out the v3 branch, and running

go run ./cmd/slackdump search messages "search terms supported by slack, i.e. user:@blah"

rusq avatar Apr 07 '24 10:04 rusq

Yes! it worked, thank you!

Now I have to write my own script for parsing and calculations 🙂

razvanphp avatar Apr 14 '24 17:04 razvanphp

Hey @rusq, tried again the feature and observed a small bug: the output file is not a valid json, it misses the array [] wrapper and , in between the objects. Is this expected?

Screenshot 2024-06-05 at 18 03 21

Otherwise it works great, I published my script as a gist.

slack heatmap 03 2024

razvanphp avatar Jun 05 '24 15:06 razvanphp

Hey @razvanphp , the output file is a valid JSONL document, where each line is a JSON object. This is done to reduce memory usage. If I was to assemble an array of million messages, that would take considerable amount of RAM, so JSONL shifts that problem to the user

rusq avatar Jun 06 '24 12:06 rusq

Pagination seems to be missing from this search function, I only get the first 70 matches, while there in the app the same search returns 65k messages.

kisst avatar Jun 26 '24 19:06 kisst

@kisst , thanks, I don't remember there was an issue last time I checked, interesting. I'll have a look.

rusq avatar Jul 09 '24 10:07 rusq