Ecommerce and Entrepreneurship Blog | About | Contact | Store

Building an eCommerce Presence on Facebook

Posted on April 28, 2010 by Trevor

If you haven't heard of Facebook, you're probably not actually on the internet. Facebook is the current champion of social sites, a giant community where people post their latest pictures, dialogue with each other, and play simple online games. It's also the hot new thing in eCommerce: sites hoping to capture the attention of that massive audience pouring onto the site.

There are three ways companies can build a presence with Facebook. First, they can put up a "Fan Page". A member of Facebook can create a page associated with a business, posting pictures, links, and comments just like any other user. Instead of becoming "friends", users can become "fans", but it's otherwise virtually identical. The second way to establish a presence on Facebook is to build an "app", a web service integrated into Facebook to provide more advanced services to users. Games are a particularly popular type of app, but there are also more traditional eCommerce platforms like that provide Facebook integration.

The third way to build a presence on Facebook is to integrate Facebook into your own site using Facebook Connect. With Facebook Connect, your eCommerce site can allow a user to login using Facebook, make posts to his or her wall and pages, and more. This allows your presence on Facebook to be spread out among your customers, rather than confined to one page or application. However, integrating Facebook Connect with your site takes a bit of skill, requiring custom code and Facebook's APIs. Recently I got a chance to do some work with Facebook Connect, and I'd like to share some of the issues and solutions I found.

Integral to Facebook Connect is the concept of permissions. Facebook asks the user's permission for any interactions with the site; that way the user probably won't be surprised or angered by something you do. One common action, for example, is to write a post to a user's wall. Each time you do this, Facebook prompts the user with a popup window with a description of what will be posted, giving them a chance to edit or refuse the post. Most of the time this is good. However, sometimes you may wish to post when the user isn't actually present to approve a post. For this, you need to request extended permissions (using "showPermissionDialog"). The two most relevant are "publish_stream", which allows you to post without explicit prompts, and "offline_access", which allows you to take actions for the user (assuming you have permission) even when the user is not logged in. There is some session information you'll need to store, but I won't go into details: you can read more at the Facebook Developer Wiki.

Another thing you might want to do is publish posts to a user's pages as well as his or her wall. This requires a bit more finesse. First, you need to know what pages a user has access to: unlike the user account, these are not given to you when the user logs in. To get them, you need to use the "query" function and FQL, a special API modeled on SQL. You can query the "page_admin" table to get the page IDs, and the "page" table to get any other information you need. Once you get the page ids, you can get permissions and post to them much like you did for the user's wall. To get permissions, you will need to explicitly list the page and user ID’s, even if you're requesting permissions for all of them; otherwise the dialog will present a dropdown to the user with only the user's wall initially selected (most users will simply click "OK", denying permission to all but their own wall). Once you've gotten permission to post to a page, simply substitute the page ID for the user ID in the "streamPublish" function. If you want to post to the page using the user's account instead of as a page self-post, keep the user ID but set "target_id" to the page ID.

As you can see, it gets pretty complicated even to perform simple activities like making posts for a user. In my own research I saw many questions and much confusion on such things as permissions and IDs. Hopefully I've given a few pointers here to get people on the right track. Although Facebook integration can be difficult, it's often worthwhile in terms of connecting with your customers and publicizing your brand.


The possibilities are endless with a bathroom remodel. Discover your classic side with a clawfoot tub, experiment with fresh bathroom vanities and coordinate it all with matching faucets. Shop 24 hours a day, 7 days a week for all of your bathroom needs.

blog comments powered by Disqus