carderne / signal-export

Export your Signal chats to markdown files with attachments
Other
436 stars 46 forks source link

It would be amazing to be able to export chat member names/numbers as JSON or CSV #111

Closed Robbbb closed 3 months ago

Robbbb commented 4 months ago

I help manage several large communities on Signal, and we often need to make membership spreadsheets. Right now this is a tedious process. Would it be possible for this tool to be extended to export JSON of a group's membership? Ideal fields would be display name, phone number, and a list of groups we are in together. It would make a huge difference for my communities.

carderne commented 3 months ago

Hi @Robbbb yes this should be possible, would need a bit of code to be written. Will try to have a look in the next couple of days.

Robbbb commented 3 months ago

Thanks so much! It would really make a huge difference.

carderne commented 3 months ago

Hi @Robbbb I just added a feature in v2.0.0 to export to a data.json file. Please try it out:

pip install signal-export==2.0.0

i didn't directly add a feature to do what you want, but if you install jq you should be able to get what you want very easilylike this (once you've run the new version of signal-export and got the data.json!)

cat data.json| jq -s 'map(.sender) | flatten | unique'

That will print a name of unique senders within a chat...

Robbbb commented 3 months ago

Thanks so much for your work!

Unfortunately I am in large groups (200+) folks that use disappearing messages and only allow admins to post. I don't think exporting the subset of users who have sent unvaninshed messages in the time since my instance of Signal Desktop was installed would help us with our problem. Would it be possible to export member lists? Any format would be welcome.

carderne commented 3 months ago

I had another look at this, and added some code that pulls out the members for each group: https://github.com/carderne/signal-export/blob/459bfe72dbda2ed0bb2c6a1df0b603fa07caa077/sigexport/data.py#L46

But the ids that come out don't seem to match the ids for anything in the contacts dict... So I'm not really sure what's going on there... I might come back to this at some point but no promises. You're welcome to dig in and have a look, if you stick a breakpoint() at the appropriate place in data.py you can run some queries against the DB...

Robbbb commented 3 months ago

Thanks for trying! My programming skills are pretty limited to chatGPT and trial and error, so I don't think I will be able to make a dent in this. I appreciate your work!