Skip to content

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 to Telegram. Currently supports: Line, Kakao Talk, WhatsApp, Instagram, Messenger, WeChat, Google Chat.

License

Notifications You must be signed in to change notification settings

realdeveloperongithub/chat-history-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chat History Manager

An extensible chat history manager. This project, combined with a modified Telegram can import all kinds of chat history into Telegram chat.

How this project was born

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:

  1. 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.
  2. 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.
  3. Support for more apps
    Telegram only supports three apps officially (Line, Kakao Talk, WhatsApp), while this project supports most of the major apps.

What does this project do

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
  • Instagram
  • WeChat
  • WhatsApp
  • Telegram
  • Google Chat / Hangouts

Prerequisites

  1. A rooted Android phone (refer to the table below)
  2. python 3
  3. ffmpeg
  4. pip install -r requirements.txt
  5. 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)
Instagram N Download Your Information (JSON format)
Google Chat / Hangouts N Google Takeout
Telegram N Chatroom - Export chat history (JSON format)
WeChat 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.
WhatsApp 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.
  1. 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

How to use

  1. Rename config-sample.yml to config.yml.
  2. Set modules
    1. In the config.yml file comment out the Parser modules and Generator modules you don't want to use.
    2. Remember that you can add multiple accounts of the same module by specifying different name. See Kakao Talk module in config-sample.yml.
  3. Settings for different Generators, see below:
Generator Comments
WhatsApp 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.
  1. Run python3 main.py
  2. For importing chat history into Telegram, please refer to this project.

FAQ

  1. 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.

To-do

  1. Support for more apps

Credit

wechat-dump

Donation

ETH: 0xbdb823ea4bcee4c5bdecc1544a29bbdd2034028a

Footnotes

  1. 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.

About

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 to Telegram. Currently supports: Line, Kakao Talk, WhatsApp, Instagram, Messenger, WeChat, Google Chat.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages