TelegramTools / TLImporter

📲 Telegram Chat Importer: Import chats from WhatsApp or other services into Telegram
GNU Affero General Public License v3.0
127 stars 11 forks source link

Import chats from Facebook Messenger #19

Open mikebreeezy opened 3 years ago

mikebreeezy commented 3 years ago

Hi, everybody I know is leaving from facebook messenger to Telegram. Is there any way to save chats from facebook messenger into a txt file that is formatted for use in TLImporter? Thanks for making this tool!

ferferga commented 3 years ago

Did you try? https://m.facebook.com/help/212802592074644/?ref=u2u

If the messages are not in a valid format, you can always reformat them yourself, much easier than copying and pasting the whole file in Telegram :).

mikebreeezy commented 3 years ago

I did try that link and it formatted it into HTML and the only other option is JSON but they are are not easy to reformat like the Whatsapp backups are.

ferferga commented 3 years ago

@mikebreeezy Then I had no idea, maybe you could make an script, regex or something so it resembles WhatsApp format (or tinker around TLImporter's code to see if you can adapt it to your necessities). Otherwise I think you're out of luck, I don't use Facebook Messenger myself so I don't know any tool or way to convert them to plaintext.

ranger21515 commented 3 years ago

I downloaded my Facebook Messenger messages through: https://m.facebook.com/help/212802592074644/?ref=u2u

And I used Microsoft Word to convert the .html into .txt, but I still failed to import the messages through TLImporter. This error message appeared as below: 螢幕擷取畫面 2021-02-02 125335

I am wondering if there's something to do with the language we used in the chat. The chatting messages and our names are all in Chinese.

ferferga commented 3 years ago

@ranger21515 You can't use Microsoft Word as it won't output a txt file, rather a docx or doc file with formatting.

You need to use classic notepad (search for that word in Start menu and it will appear) or a third-party tool like notepad++.

Make sure that the formatting you end up with in the txt is the same as the one provided in my samples. If it's the same, it's unlikely you will face further problems.

Have a nice day!

EDIT: Forgot to mention about the Chinese thing. No, you shouldn't have any problems as the all will handle everything UTF-8 just fine (make sure to save with that encoding while using notepad, the encoding option will appear near the "Save" button in the "Save as" dialog while saving the file). You also must make sure that the partner's names you give to TLImporter are exactly like the ones you have in the txt file, including emojis and such. Not sure if that's intentional from your side but, for example, the names that can be seen in the screenshot you provided doesn't have Chinese characters, so beware of that! :)

ranger21515 commented 3 years ago

螢幕擷取畫面 2021-02-03 141433

I just did what you've told me. I copied and pasted the message content into a Notepad and saved the file as a .txt format with UTF-8 encoding. But I still failed to import my message into Telegram through the TLIporter and got this error message as above.

I guess the problem is the layout of the message exported from Facebook Messenger. It shows like this: 'Name' 'message' 'YYYY/MM/DD' 'time'

Unlike your example given as: 'MM/DD/YYYY' 'time': 'Name': 'message'

What do you think? I'm almost about to quit but appreciate your work and patience anyway!

ferferga commented 3 years ago

@ranger21515 Yes, it's a format issue: as you can see, it isn't able to locate the name of the people in the txt as it can't recognize the format provided.

You must format the messages manually or using a regex, so it looks like the sample one. Otherwise it will never work.