Moving WhatsApp from WM10 to Android/iOS

Today I made an attempt to move my WhatsApp messages from WM10 to an Android Phone.

If the journey is TL;DR; jump to the end of this blogpost for a download link and some remarks on limitations.

In it’s greater wisdom Facebook has decided that each phone should have a separate backup destination that prevents easy migration. It looks like this:


Operating System Backup Destination
Windows Mobile 10 OneDrive
Android gDrive
iOS iCloud

This besides the on-device backups off-course which are incomplete as they are encrypted and the keys to decrypt it are saved outside reach for normal not rooted phones.

So what to do. I tried some tools to unlock my Lumia 550 but especially the x5x models are hard to gain access to. Moving the local backups from WM10 to an Android phone also fails. WhatsApp will only allow to restore backups at first start, just after installation. The WM10 files lack the encryption suffix that tells WhatsApp what encryption method was use.

After an afternoon without much success I attempted a totally different attempt. I notices that WhatsApp web (and the ‘native’ desktop version) shows all messages on my desktop. This application however does not store anything local as far as I could detect. It seems to use the phone it’s linked to for message retrieval.

So I tried to cut/paste conversations. WhatsApp web (both the browser version and the ‘native’ application) however do not support the almost universal shortcut Ctrl-A (select all). Selecting with a mouse by dragging is also awkward as not all messages are loaded. What works is to scroll totally to the top of a conversation and click somewhere outside a text balloon. Then scroll down again and click after the last text balloon. The text should color selected and Ctrl-C works.

Pasting it reveals Unicode text that starts with a square bracketed timestamp and a contact name.

So I started writing a little C# application that saves the clipboard if it contains Unicode text starting with the ‘[‘ opening bracket and the first line contains a closing ‘]’ bracket as well. Other encodings seem to loose the emoticons in the text so are of limited use.

WhatsApp protocol

During searches I came across URL’s that can be used for ‘click to chat’. I started experimenting with these links but they all had the issue that the browser based version would popup and display a message if you want to switch to the desktop application.

To get rid of this phenomena I used some code I had coded last year that registers a custom protocol to launch an executable. So next up was to locate the desktop WhatsApp executable. In Windows its not that hard to find a window by its caption (‘WhatsApp’) and obtain the executable. So enough data to register the whatsapp:// protocol to launch WhatsApp. Some details had to be coded like elevating the application so the registry can be written. Luckily code I had available from previous projects.

Now starting a URL with a phone number and UrlEncoded message as query parameter nicely drops the text into the edit field of the WhatsApp desktop application without a browser intervening.

Last issue to solve was how to submit the message. Some googling led to code that simulated a keypress on another window. Combined with the size and position of the WhatsApp window and a small offset for the location of the send button in the bottom right corner all started to work properly.

image

Basically what the migration tool does is send all saved chat conversations from yourself to yourself. This results in the messages all being in a single conversation but searchable in WhatsApp. Timestamps of the messages themselves carry the date/time of migration. However the tool posts complete messages including the original timestamp and sender (so searchable).

Notes

Note: The migration tool works with the x64 bits Windows version only (download from the WhatsApp download section).

Note: Selecting and Copying conversations takes some practice. Sometimes the timestamps are missing. Then just click at slightly different spots.

Note: Editing the pasted files is possible with Notepad. Make sure the files stay UTF-16/UTF-16 LE and have Unix line-ends (LF)

Note: Media are not including (but these are often saved separately and not encrypted on an SD-Card and can be retrieved easily.

Migration work-flow

  • Link the desktop WhatsApp Web (x64) application to your old phone.
  • Select, copy and past the conversations one by one onto the migration tool (and save them with a name matching the conversation). To paste either activate the migration tool window and press Ctrl+V or right click and use the context menu.
  • You now have a backup of all chat messages on your computer.
  • Link the desktop WhatsApp Web application to your new phone.
  • Make sure WhatsApp is detected properly and the ‘whatsapp://’ protocol can be registered. The migration tool needs to restart elevated to register (so you need to press the button again when the elevation shield is no longer shown).
  • Enter your phone number (full international number without a leading + sign)
  • Press the Send Messages button and take some coffee (I had to add some delays between messages).
  • Optionally the migration tool can prepend the filename to the message for better searchability.
  • The two blue underlined labels open explorer windows to the WhatsApp installation folder and the folder where chats are saved when pasting.

TL;DR; section

Recap: this migration tool transfers messages from your old phone to a single searchable conversation on your new phone excluding any media files.

  • The WhatsApp Migration tool can be downloaded from bitbucket.
  • C# sources are available at this bitbucket git repository.
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s