Signal-Android icon indicating copy to clipboard operation
Signal-Android copied to clipboard

Importing WhatsApp group chats without their participants

Open Terrance opened this issue 2 years ago • 6 comments

(I'm not sure if this is the right place to ask as the WhatsApp import stuff appears to be across two other forks, but it's present in the build from this repo so is presumably being maintained in some capacity here.)

I've got a handful of WhatsApp groups who have since moved to platforms other than WhatsApp and Signal, but I'd like to keep a copy of the message history in Signal. I created empty groups matching the names of these groups, and the import option correctly matches them up, but only my own messages are imported -- presumably this is because the other participants are not in the group. Is there a way to get their past messages imported too, without adding them to my copy of the Signal chats?

Terrance avatar Apr 19 '22 06:04 Terrance

I didn't write that code so I'd have to look at that, but I will have to have it updated anyway now that WhatsApp introduced reactions too.

johanw666 avatar May 11 '22 09:05 johanw666

Did this get anywhere by the way? I recently had to crack open my backup WhatsApp database in order to find a message from an old group chat, so I'd still be interested in importing these to Signal.

At a guess, it's to do with the recipient resolution here:

https://github.com/johanw666/Signal-Android/blob/99b18498027917f85aaec42ba60e139e43700e02/app/src/main/java/org/thoughtcrime/securesms/database/WhatsappBackupImporter.java#L167

From digging a few layers deeper, I can't see it trying to create new recipients during group import, only resolve existing ones.

Terrance avatar Mar 01 '24 10:03 Terrance

I can take a look but to be honest I have no time to maintain this import function at the moment. It could very well not work due to a changed WhatsApp database structure.

johanw666 avatar Mar 01 '24 11:03 johanw666

Would supporting the import of plain-text chat backups be a better option? I grabbed copies of those too, and I've seen other apps (e.g. Telegram) use them for migrating messages around too.

The directory structure is a folder per chat, named after the recipient or group, with attachments and the chat log inside:

First Last/
    IMG-20240229-WA0000.jpg
    IMG-20240229-WA0001.jpg
    WhatsApp Chat with +44 7766 543210.txt
Group Name/
    WhatsApp Chat with Group Name.txt

The chat log itself looks like this:

29/02/2024, 12:33 - Your security code with +44 7766 543210 changed. Tap to learn more.
29/02/2024, 12:34 - My Name: Outgoing message
29/02/2024, 12:35 - +44 7766 543210: Incoming message
With multple lines
29/02/2024, 12:36 - ​My Name: IMG-20240229-WA0000.jpg (file attached)
29/02/2024, 12:37 - +44 7766 543210: <Media omitted>
29/02/2024, 12:38 - ​My Name: IMG-20240229-WA00001.jpg (file attached)
Caption for attachment

Terrance avatar Mar 01 '24 11:03 Terrance

I think it would be easier to convert that to xml and use the existing plaintext import. But that won't work for groups, you would get the messages in a 1-1 conversation and not the group structure.

johanw666 avatar Mar 01 '24 15:03 johanw666

It also wouldn't include media, which is more pressing as there's a lot of attachments that ideally I'd keep associated with their chats. Between this and a couple of chats from another app (one that provides its own backup format that I intend to massage into something suitable for Signal), it seems like the WA database is still the way to go, but groups without the message authors as members can't currently be imported in any of the flows.

Terrance avatar Mar 01 '24 16:03 Terrance