As I promised earlier, I’ll be telling you a simple method to use Facebook in built API to read someone’s Facebook messages. Since, I don’t want this post to be misused by others; therefore I’m not going to provide the whole automatic code that could perform this task. But, anyways you can accomplish this task manually and explore the power of Facebook Graph API.
Please Read this before you proceed: “I’ve written this tutorial just for the purpose of awareness and show you the amazing power of Facebook Graph API. It has nothing to do with any un-ethical means. Please don’t use any of the information provided below for any misuse. If you do, you are solely responsible for the consequences that it causes.” – Lavneet Sharma
So, let’s start with a basic knowledge about Facebook’s Graph API (what is it and how useful it is for developers)
Basically, an API is a set of pre written piece of code (usually, by the company to whom it is associated) that you can use directly by writing a single line of code in your program. Being more specific, consider following scenario:
As an example, consider a piece of Facebook code which on execution gives a list of all friends present in the friend list of a person whose username is user543981.
Now, this code would be of hundreds of lines, which can only be written by Facebook officials and no one else (Of course, Facebook won’t tell you which code they use for retrieving someone’s friend list :p)
But, what if you are developing a Facebook application which involves retrieving someone’s friend list from his account?
For this reason, Facebook launched its API in which you just need to type a single line of code along with a specific parameter to identify what you are talking about.
For example, it may be,
frndList = retrieve_friend_list(user543981)
in which, retrieve_friend_list() function acts as an API for retrieving someone’s friend list on Facebook and storing it into a array variable frndList. For this function to identify a particular user, we have passed username in its brackets. Now, this API is a best way to prevent facebook code from being revealed and also helping Facebook application developers to develop apps with great flexibility.
Now, how this API thing can be used to read someone’s messages?
Facebook Graph API is a very big technique for which I’ll write some another day. But for now, I’ll explain you how it’s going to work for reading Facebook messages. Just follow below given steps:
STEP 1: When someone visits this link, Click to visit the link
It will present you with a page which will show you options to either Install or Cancel.
(If he/she has already installed this app, then it will show “Success” written on the Page)
STEP 2: If the person clicks on Install button, then the URL in the top address bar changes as shown in below screenshot:
This URL contains a portion having, access_token= <Some_Random_alphabets> which is the actually required by the graph API to perform read operations on Facebook.
STEP 3: Now, it’s upto you, how you get this part of URL (or complete URL if you can) from your friend whose messages are to be read. You can write a Facebook app for this purpose if you have knowledge about it (or else, I would soon be writing on the same).
STEP 4: Now, after you get this access_token = <Some_Random_alphabet> part, type below given URL in your address bar:
https://graph.facebook.com/me/inbox?access_token=<Some _Random_alphabet> as shown in below given screenshot:
As soon as you type above URL, all the messages of person will be shown in the form of JSON array. It will show you the last 10 messages that were sent or received to 10 people.
However, is you want to read further messages, simply scroll down to the bottom of the page and copy the URL that follows, “next” as shown in the below screenshot:
So, this is a complete tutorial on how to read someone’s Facebook messages using Graph API. I wrote this article just for educational purposes, please don’t misuse in any form.
Stay updated with more updated @freaksense