How to read deleted messages on Facebook? – Node.js

Tram Ho

1. Introduction

Have you ever wondered: How to read deleted messages on Facebook?

Do wives who want to manage their husbands text or flirt but can’t be online 24/24 with their husband’s account to check?

Or simply record the messages the other person removed from the message as evidence, depending on your purpose.

Note: This article does not help you to read previous messages (before the time you do the following)

2. The idea

The simple idea is to make a pike all the messages sent to your account and save it somewhere else.

3. Requirement

  1. Node.js version> 8

4. Brainstorming

Geez, what did this guy use the API API of the facebook guy called to play …

Oh no .. The Facebook Graph API is for accounts only a Page ..

Give up? Think of another way …. Create a login request on facebook and then get the message? Noooooo …

Na nì ?? I heard that Facebook is also very secure … This song is tight, …. Log in with Facebook again, then facebook will force me to verify my identity and then unlock it ??

Facebook-chat-api

A few days after despairing about the phishing idea, wandering on the github, I saw a facebook-chat-api (Unofficial) repo that allowed me to manipulate most of the functions of facebook messenger.

Link repo: https://github.com/Schmavery/facebook-chat-api

Start to find out what kind of facebook login it is.

With some desciption on this repo, it will specifically simulate a browser to be able to login to facebook. => So that’s how it is. Fool your Facebook using a browser to login ??

5. Let’s give it a try

See repo or good then shake hands and do it ?? .

Here I default that you are using Ubuntu and have Node.js version> 8 installed already on your computer.

If you do not have it installed, follow the instructions below:

Install node.js

Install npm:

Check if the installation was successful:

If this is successful, then !!

Create a new folder to start doing

Move to that directory with the following command:

Init npm use the following command:

You will see that node_modules and package.log and pakage.json have been initialized in the directory. Next, we will try to install facebook-chat-api

Create a test file with the following command

Open the newly created file letter and add the following content:

In which replace FB_EMAIL and FB_PASSWORD with the email and password you login to facebook.

* Note: It looks good ?? but haven’t run yet, bro =))

Test run with:

And get the error:

Gosh, Facebook detected that I was logged in with a strange browser or it detected that I was logged in with facebook-chat-api and blocked the login.

For some accounts, this situation will be encountered, and my account was no exception

Back to facebook login with browser and it forced me to verify new identity … Haizzz ….

Find a solution

Continue reading Docs of this facebook-chat-api to see that it supports both login with 2 Factor Authentication

If you log in normally, facebook won’t allow you this time to force login with One-time-password (OTP).

The doctor proceeded to download the Google Authenticator App on his phone. Turn on 2-layer security of Facebook in Settings> Security and Login (Security and Login)

Select Use 2-factor authentication> Authentication application

Edit the testlogin.js file

Still replace FB_EMAIL and FB_PASSWORD with the email and password you log into facebook and go to the console to try:

Go to the Google Authenticator App and enter the OTP code currently displayed and the result:

So finished login already ???

But every time I log in, I have to log in, I have to enter the 2-layer security code like this, it’s not very convenient …

But this package also supports us when we log in with cookies. We will proceed to login for the first time with the account and password as usual => Facebook returns cookies => we save it to use for the next batch of login.

We continue to fix the testlogin.js code

So after logging in, we will create a file and save the facebook cookie and the login code with the cookie might look like this:

Save the message to the database. (Google Sheet)

The poor don’t have enough rent for database server, so I have to choose google sheet as database.

You guys create a form using Google Form

Create the fields you want to save with the questions in the form.

Notice where you highlighted the address bar. The doctor took out the form id The doctor assigned it to the code below we will be a link to post data to:

Switch to the response tab and select Create Spread-Sheet

And our sheet looks like this:

Continue to move on to the Google form section, select Preview (The eye image above)

On this tab, inspect the field names of the input fields that get these entries

Next go into the code because for added security we will create the following file:

File getappstate.js

In which replace process.env.USER_NAME, process.env.USER_PASSWORD with your facebook login account if you run it locally, and if to deploy onto a server, you should leave it in a certain .env file. (The code above is used to deploy to heroku)

File worker.js

So the backend code part is done then. Let it run, guys do this turn.

And enjoy the results.

6. Deploy to Heroku

If you want him to run 24/24, Deploy to Heroku.

Please install Heroku CLI:

Create a Procfile file to define the worker.js file that runs as a worker.

The file content is as follows:

Conduct deploy: Create 1 project on Heroku, add remote for herokugit, guys refer to it online. On my computer:

Create .gitignore file and ignore /node_modules .

Config environment variables for the project:

Replace abcxyz with your user name and password

Get appstate:

Go to heroku project> Resources and turn on the worker and enjoy the results!

Conclude:

I wish you success!

* Note: So there is data, how to display it depends on how you guys do the frontend. You can use other databases instead of google sheet like Mongo, Mysql, …

Google sheet also has a limit of 5 million Cells, guys.

Actually I am using DynamoDB and if anyone needs it, I can share the code.

Share the news now

Source : Viblo