How to Build a Facebook App for Your Page

Build a Facebook app to share the many facets of your page

A screenshot of the Facebooks SDK for iOS website.

Perhaps you've heard about Facebook apps and are interested in creating your own for your cause, company, organization, or personal use. You don't have to be a geek to accomplish this. Take it step by step, and with a little knowledge of PHP and MySQL (a popular open-source database management system) and the tools that Facebook provides, you can build your own Facebook app.

What Is an App?

Facebook developers build most of the common apps you'll find on Facebook; in fact, Photos, Events, and many other core features of Facebook are actually separate apps. In addition, thousands of other third-party apps are available for installation into your personal Facebook account.

An app (not to be confused with the similarly not-quite-a-full-application called an “applet”) is not really an application in the sense that Mac and Windows computer users know the term. Whereas you install computer applications (also known as software and programs) from a disk or a download onto your computer's hard drive, a Facebook app runs within your browser and takes up no space on your computer.

For example, if you're using an app to play Scrabble with a friend on Facebook, Facebook stores each move you make on its servers, not locally. The page updates when you log in again or otherwise refresh your browser. This is the core difference between a Facebook app and a conventional application.

What Is the Facebook Platform?

Facebook launched the Facebook platform on May 24, 2007, providing a framework that developers can use to create applications that interact with core Facebook features. Apps can share user information with outside applications via an open API (application programming interface). The Facebook platform provides a set of APIs and tools that enable third-party developers to integrate with the open graph — whether through applications on or external websites and devices.

Why Do You Want a Facebook App?

What can your business use a game like Scrabble for? Very little, but games are not the only use of apps. Any entity that wants its name shared in a social media sphere can use an app to create brand recognition.

Consider this scenario: You own a restaurant with its own Facebook page. Many people post mundane “tuna salad sandwich for lunch” status updates, which tend to annoy followers. The page is popular, but not many customers seem to be "liking" it. Now imagine the page having an app that lists menu items, complete with photos, that users can select and share. Instead of a boring status update or a mere link to your page with a phone number and address, an app can let that user share a more eye-catching view of what they just ate in your restaurant. It's easy for users, and in this way, you harness the value of social marketing.

Not sure how to leverage the power of an application for your business or organization? Find some ideas and inspiration in the Facebook App Center.

How to Get Started Building an App

To get started, you must have a Facebook account. From there:

  1. Create a Facebook page for your business or organization. Your personal information is safe and not tied to the page if you don’t want it to be.
  2. With your existing Facebook account, add the Developer application to your Facebook profile.
  3. Click Set Up New Application. Follow the procedure for naming it, agreeing to some standard terms of service, and uploading an image for its logo (you can change this later).
  4. From the Application settings, choose Canvas and set HTML as the rendering method. A canvas page is simply the main page of your application that the user sees each time they click on your app. The Canvas URL is the unique name for your app @ You can flesh it out with icons, descriptions, etc. The Canvas Callback URL is the full URL of the canvas page that your MySQL server will store.
  5. Log in to the web server where you’ll be hosting the Facebook App and create a subdirectory called “facebook.” So, if your domain is, the Facebook app can be accessed from
  1. Using the text editor of your choice, write the content that you want to display inside your Facebook application.
  2. Now you'll create a setup page for users who wish to add your app. If you're a beginner, use the official PHP client. The following example shows a simple image. Go to the file you entered in as the Canvas Callback URL — the jump-off point for all calls from Facebook to your application — and enter the following:
// Include the Facebook client library
require_once ('facebook.php');
// Set authentication variables
$appapikey = '';
$appsecret = '';
$facebook = new Facebook($appapikey, $appsecret);
// I also will be accessing my own database on almost every call so will set db up here
@mysql_select_db($database) or die( "Unable to select database");

You are now ready to interact with the Facebook API.

Using the Facebook API

The Graph API is the core of the Facebook platform, enabling developers to read from and write data into Facebook. The Graph API presents a simple, consistent view of the Facebook social graph, uniformly representing objects in the graph (e.g., people, photos, events, and pages) and the connections among them (e.g., friend relationships, shared content, and photo tags). Along with the application directory, this is the most powerful aspect of the Facebook platform for developers.

With the right incentives, marketing, and branding, apps on Facebook can spread like wildfire. Two features that Facebook developers often use to broaden their audiences are app invites and posts to newsfeed stories. Both tell Facebook users which of their friends participate in the app. They differ in that an invite is an explicit question targeted at friends of the app user’s choice; on the other hand, the newsfeed option simply lets others know that a friend is using an app. Getting a user to send out invites is more difficult because such invites aren’t always welcome; however, if a user sends them to those who might be genuinely interested in the app, this can lead to signups.

That’s it. Anyone can now add your Facebook app to their profiles either in the Boxes tab or in the sidebar of the main profile page.

Facebook App Tips and Tricks

Here are a few ways to dazzle your app users:

  • Incorporate RSS feeds in your Facebook apps through a feed-parsing library such as SimplePie.
  • Track your Facebook application usage via Google Analytics.
  • Use the same CSS styles and color schemes for your Facebook apps that you use on your main Facebook page.
  • If you are using your Facebook page as a way to network, consider adding the BranchOut app to your Facebook page.
  • Take advantage of Facebook for Developers and the Help Center.
  • If this sounds too complicated, check out services such as OfferPop and Wildfire. These types of companies offer prebuilt apps that you can customize for a fee; however, give app building a try before spending money on a service or developer to build a Facebook app for you.