Facebook – download chat history

facebookfacebook-messenger

I have a quite long (several thousands of messages) chat history with one of my friends which I'd like to download and store safely on my own computer.

I did not bear this in mind from the beginning though and I therefore have no related browser plugins installed.

All of the messages are still available on Facebook – I am able to reach them all when I scroll for a while.

Is there a way to retroactively download the complete chat history?

Searching google did not provide any help.

Two options come to mind (both of them seem very laborious):

  • copy&paste all the messages manually,
  • write a script that would automate that (using e.g. Selenium).

Best Answer

Unfortunately your solutions might be the best ones, although if you are using Chrome, there might be a way to use the Inspect Element dashboard to pull the chat text.

Right-click on the chat window and select Inspect Element. You will see all of the rendered tags from the page, and the chat messages will appear there, all with the class:

<div class="fbChatMessage fsm direction_ltr" data-jsid="message">This is a chat message in the window</div>

To get the entire conversation, look for:

<table class="uiGrid conversationContainer" cellspacing="0" cellpadding="0" >

Then Right-Click > Copy as HTML - You can then paste the entire chat table into another file and parse it (eg using regex)

Related Topic