An extensible chat history manager. This project, combined with a modified Telegram can import all kinds of chat history into Telegram chat.
Originally, this project was to import chat history into Telegram, but now we can do more with it. In January 2021, Telegram announced a new feature for people to bring their chat history – including videos and documents – to Telegram from apps like WhatsApp, Line and KakaoTalk.
The founder of Telegram, Pavel Durov, on his personal channel also promised to provide "free APIs for third-party developers who want to create tools that will allow users to import messages to Telegram from anywhere".
The API has been published, but for me, it is not easy to manipulate it. And the existing way of importing chat history has many to be improved:
- Images and videos
Images and videos import is only available when you import chat history from WhatsApp. When you import from Line or Kakao Talk, all the multimedia files will be ignored. - 100 messages limitation
If the target chat (where you import messages to) has fewer than 100 messages, Telegram will mix the existing messages in a Telegram chat with the imported messages in one unified timeline. However I believe most people have more than 100 messages in the chat. - Support for more apps
Telegram only supports three apps officially (Line, Kakao Talk, WhatsApp), while this project supports most of the major apps.
Basic feature:
With multiple Parsers and Generators, this project helps you to organize chat history from other apps. Theoretically, if you are able to create a parser, you can import chat history from any app you want, including the old-fashioned online chatroom :)
Exclusively for Telegram:
If you convert all chat history to WhatsApp format, you will be able to import all chat history into Telegram, with a unified timeline and with all media files reserved.
Supported apps:
- Line
- Kakao Talk
- Messenger
- Telegram
- Google Chat / Hangouts
- A rooted Android phone (refer to the table below)
- python 3
- ffmpeg
pip install -r requirements.txt
- Different source apps have different requirements, see below:
Source App | Root Needed | Comments |
---|---|---|
Kakao Talk | N | Chatroom Settings - Export Messages |
Line | Y | Chatroom - Other settings - Export chat history. A local database at /data/data/jp.naver.line.android/databases/naver_line Resources file at /storage/emulated/0/Android/data/jp.naver.line.android/files/chats . |
Messenger | N | Download Your Information (JSON format) |
N | Download Your Information (JSON format) | |
Google Chat / Hangouts | N | Google Takeout |
Telegram | N | Chatroom - Export chat history (JSON format) |
Y | A decrypted WeChat database (EnMicroMsg.db) and all the resources files. All the voice files need to be converted to opus format (you can refer to silk2mp3 and then convert mp3 to opus). Please refer to the wechat-dump project. |
|
Y 1 | Chatroom - More - Export chat All files under /storage/emulated/0/Android/media/com.whatsapp/WhatsApp/Media need to be collected and put into one folder. |
- All the voice message files need to be converted to .opus format. Here's a code snippet for converting all amr files in one folder.
find /folder/to/amr/files -name '*.amr' -print0 | \
xargs -0 -I FILE \
sh -c 'ffmpeg -i "$1" "${1%.amr}.opus"' -- FILE
- Rename
config-sample.yml
toconfig.yml
. - Set modules
- In the
config.yml
file comment out the Parser modules and Generator modules you don't want to use. - Remember that you can add multiple accounts of the same module by specifying different
name
. See Kakao Talk module inconfig-sample.yml
.
- In the
- Settings for different Generators, see below:
Generator | Comments |
---|---|
send_recv_dict is the dict for mapping from different usernames.base_numbers defines the new name of media files. Leaving it unchanged or change it to current date is recommended. |
|
HTML | send_recv_dict is the dict for mapping from different usernames. |
- Run
python3 main.py
- For importing chat history into Telegram, please refer to this project.
- Support for iOS
This project is actually manipulating WhatsApp exported files in the system level. That's why a rooted Android phone is a must. Sadly on iOS, we can't do that. In other words, the target chat (where to import the chat history) must be on Android platform.
The good news is, though, we are importing chat history to Telegram, so after importing, all the chat history will be also visible on your iOS devices.
- Support for more apps
- Skype (Export data)
ETH: 0xbdb823ea4bcee4c5bdecc1544a29bbdd2034028a
Footnotes
-
Root is not needed if there's not much media in the WhatsApp chat. In that case, share to local storage with a file manager (for example Solid Explorer) will do. ↩