Hello there,
Welcome to scaleyourapp.com

This article is a comprehensive write-up into Facebook SDKs & APIs. It will answer all your questions such as What are they? Why do I use them? What is the difference between an API & SDK? What is the need for both? Can I fetch user data from Facebook with the help of APIs? Can I build games on Facebook using the APIs?

So, without any further ado. Let’s get on with it.

Before delving into the specifics of the Facebook API. Let’s quickly refresh our concepts on what is an API. It won’t take much time & would be very helpful, I promise.

1. What is an API?

API stands for Application Programming Interface. Put in simple words API helps us connect with an external system, like a web portal or an operating system & consume/write data to & fro from it.
All the big social networks like Twitter, Facebook etc. expose their data to the developer community via their APIs.

There is only so much features a single entity like Facebook can develop for their portal. APIs extend the functionality of the product or the portal by enabling the third-party developers write specific functionalities they want to.

2. What is a Facebook API?

Facebook APIs are the primary way to connect with the massive Facebook platform programmatically. Third-party developers create cool Facebook apps, games, steam live programmatically, run automated marketing campaigns, manage their business pages all with the help of the Facebook APIs.

Let’s say you want to build a really simple app which would notify you of the latest posts by the pages you follow on Facebook. For this, we would first need the data of the pages you follow on Facebook. This can be achieved via the Graph API. The most commonly used Facebook API.

I’ll talk about the Graph API in depth but before that, let’s find out what are the several APIs made available by Facebook to the developer community.

3. What are Different APIs Offered by Facebook?

Facebook developer portal lists out several APIs such as:

1. Facebook LIVE API: Facebook video LIVE API enables apps to stream LIVE directly to Facebook user profiles, pages & groups. The app steaming LIVE should be able to use an encoder to stream LIVE to a url & it is good to go.

2. Instagram Graph API: The Instagram Graph API enables the businesses to manage their Instagram business accounts programmatically. Using it businesses can easily manage media objects, read comments, metadata, understand insights and metrics of their account.

3. Facebook Marketing API: Facebook Marketing API enables businesses to run custom marketing campaigns on the Facebook advertising platform. Business can write scripts to create custom marketing rules and plans based on the user responds to their ads.

4. Facebook Pages API: Facebook Pages API lets us manage our Facebook brand pages programmatically. The API enables the apps to post content on the pages. Chances are you might have already used tools using the Facebook Pages API. There are so many social media tools out there which help us schedule, manage posts on Facebook. Digital marketing industry uses this kinda stuff all the time.

5. WhatsApp Business API: WhatsApp business API enables businesses to reach their customers on WhatsApp. Messenger based communication is gaining traction in the present industry trends, simply due to the customer proximity & will continue to be so. Business can leverage the API to develop a deeper connection with their user base.

6. Facebook Graph API: Graph API is the oldest, most popular & most commonly used API offered by Facebook. Every single app interacting with Facebook makes use of the Graph API to manage data. I remember back in the day when I wrote my first Facebook app.

Graph API was the only API available on the Facebook developers portal. I used the Facebook JavaScript SDK & the Graph API to build the Google map-based app fetching my friend’s cities from Facebook. It was a fun experience.

Let’s talk a little more about the Graph API.

4. What is Facebook Graph API?

Facebook Graph API is the primary way to interact with Facebook programmatically, as already stated earlier. With the Graph API, apps can read & write data to Facebook. All the Facebook SDKs use the Graph API too. I will talk about the SDKs further down the article & how it is different from the Graph API. For now, let’s focus on the API.

You must have come across Login Via Facebook feature on third party websites or apps. That is made possible by the Graph API. The API uses OAuth token to let users’ login in into apps via their Facebook credentials. Though it doesn’t share the credentials with the third-party portals. The Facebook API verifies your credentials & generates a unique authentication token & passes it to the third-party app, verifying the login process.

Graph API is an HTTP based API via which apps can post on users walls, upload photos, share events & stuff.

4.1 Basics of Facebook Graph API

As we can figure out from the name. The API is a social graph. Just like any other graph, it has nodes & edges. There is a third element known as the field. What are they? I’ll explain.

Nodes – Nodes represent individual users. Technically they are individual objects with a unique id which are linked with each other via edges. Other nodes in the graph are our friend’s nodes.

Edges – An edge represents a link between one node & the another.

Field – Field represents the data about an object like his name or the pages he likes & stuff.

4.2 How Do I Access the Data from Facebook Via Graph API?

To interact with the Graph API, you need an access token. And that is generated after we login into Facebook.

The Access Tokens conform to the OAuth 2.0 protocol. OAuth protocols enable apps to authenticate users via a certain popular portal’s credentials without actually sharing the credentials with the apps.

Below is a typical screenshot of the user permissions required before accessing his or her data via Graph API.

scaleyourapp.com Facebook Login

When the user logins into your app via Facebook. Facebook prompts the user to provide permission to the app to access his or her data. All this is made possible by the Graph API.

After the user grants the permission to access his data. Graph API sends the data to the app. Developers can choose what data to fetch by specifying the fields listed in the Graph API documentation.

For more information read the official API doc here.

Well, this was pretty much about the Facebook Graph API. Moving on with What is Facebook SDK?

But before that, let’s figure out, why the need for an SDK when we already have an API?

5. What is the Difference between an API & an SDK?

As we already know an API is an interface to a portal. We interact with the portal, exchange data to & fro with the help of an API. But the specifications, information is limited.

There is a certain limit to the understanding of the system we gain via an API. On the other hand, an SDK (Software Development Kit) contains much more stuff in regards to developing software for a particular system. Focus on the word Kit.

SDK is a complete kit to write software with regards to a certain product or a web platform.

An API is a subset of an SDK. An SDK besides containing the API would contain documentation, compilers, runtime environments, several tools.

Let’s understand this with the help of the Java programming language.

A Java API offers the core features of the programming language. So, if we want to write a calendar app, we will use the Java Date API.

But a Java SDK also known as JDK contains JRE (Java Runtime Environment), Compilers, in-depth documentation, miscellaneous tools & stuff.

Makes sense?

So, now we have a clue why Facebook offers an API & an SDK. Several SDKs to be precise.

6. What is a Facebook SDK?

Facebook Software Development Kit, enables third-party developers to write applications for Facebook. Be it a birthday wishing app, an online multiplayer strategy game which we play with our friends on Facebook or managing a business page programmatically.

By writing applications for Facebook, I mean creating apps which integrate with Facebook. Apps which require data from Facebook like friend’s birthday’s, their current cities & stuff to achieve the desired functionality.

The apps either run standalone, just require the user to login via Facebook or it may run within the Facebook Iframe, Facebook messenger or if it is a game it might run in the Facebook Gameroom desktop client or the messenger.

Facebook APIs like the Live streaming or the Graph API are a part of the Facebook SDKs.

There are several SDKs, like many, offered by Facebook for different platforms & programming languages. For instance, Facebook SDK for Android, IOS, JavaScript, PC Games, PHP, React, Swift, Unity, a business SDK. An SDK for writing apps for television. Cool stuff!!

There are also other third-party SDKs which are developed by the active community of developers building applications with Facebook. A couple of examples are Spring Social for Java, FBgraph for NodeJs, Windows SDK for Facebook by Microsoft.

Let’s dig a teeny-tiny bit deeper into the SDKs offered by Facebook.

6.1 What is Facebook Android SDK?

Facebook Android SDK enables mobile developers build Facebook apps for Android. It includes features like tracking analytics, data trends, insights on the traffic on your app. User behaviour on how people interact with your app. It also helps track ads engagements, which ads are working which aren’t. Custom ads for custom audiences.

It provides a login feature via which users can easily login to your app. It put you off the hook, you don’t have to write a dedicated login system for your app.

Mobile developers can leverage the Facebook Graph API to make their app fetch desired user data from Facebook, after seeking user permissions.

There are so many features which Facebook Android SDK offers to help your app craft an amazing user experience.

6.2 What is Facebook PHP SDK?

Similar to the Facebook Android SDK, as delineated above, Facebook PHP SDK offers all the features required to make your PHP based game, Facebook canvas app or the page tab stand out.

The SDK does all the heavy lifting for the developers providing them with the desired user data from Facebook.

Using it apps can upload videos to Facebook, retrieve user profile, run batch process & what not.

7. How Do I Become a Facebook Developer & Create Cool Facebook Applications?

To write Facebook apps, we need to have a Facebook account. That’s the first thing. I know reading this you might be like Duh…

Navigate to Facebook developers portal

Click on the top right-hand corner & Add a new app. After you click on the new app link. You should get the below view on your monitor.

scaleyourapp.com New App create Facebook

Fill in the details, register your app with Facebook.

The Facebook developers portal will create a unique id for your app, which we have to feed in your app code. This is how Facebook recognizes your app.

The next step is to select the appropriate SDK as per your requirements & the programming language you write your app in.

Visit the Facebook doc page & scroll to the APIs & SDKs section to take your pick.

Well, this was the Gist of it. Going into too much technical details isn’t the purpose of this article. I’ve primarily written it to educate about the very basics of writing apps with Facebook. It’s kinda 101 lecture on apps with Facebook.

Ohk!! so I get it. I can write Facebook apps using APIs & SDK. But can I build games on Facebook too?

8. Can I Develop Games On Facebook too?

Absolutely!! you can. I’ll write another article on developing Facebook Games.  Information on that is massive. There are so many services & stuff for games made available by Facebook. Canvas games, Instant messenger games, integration with PC Games & everything. It’s really hard to accommodate everything in this article. So stay tuned.

9. More On the Blog

How Evernote migrated & scaled their cloud with Google Cloud Platform

Why Bitcoin Cannot Be Used as a Real Currency in Our Everyday Lives – Simply Explained

What is Swagger? And Why Do You Need it for your Project?

What is Amazon GameOn Everything You Should Know About It

What Database Does Facebook Use? – A 1000 Feet Deep Dive

Well, Guys!! This is pretty much it. I would love to know the thoughts on your mind.
Do let me know in the comments.
If you liked the article, do share it with your geek friends.
I’ll see you in the next.
Until then…