Follows Action

For developers building social apps, Facebook provides an Open Graph og.follows action. The og.follows action enables a person to subscribe to another person's activity in an app.

This action can only refer to the common profile object.

This action and associated object types are automatically added to the App Dashboard when you use the action for the first time.

This document covers the following topics:

Code Samples

You can find platform-specific code samples on how to create, read, update, or delete an og.follows action in the API Reference Guide.

Overview

People can follow other persons' Open Graph activities from a specific app. For example, on a movie review site, people can follow their favorite movie reviewers. When a person follows another person in your app, all of the content published in your app by the publisher is eligible to be displayed in the follower's News Feed even if they are not Facebook friends (as long as the privacy on the actions published allows the follower to see the post):

Publishing Follow Actions

Like other common actions, you must post one og.follows action before you can submit it for approval. Once you've created one action, you can submit it for approval (admins, developers, and tests of the app can use the action before approval). To follow another user's activity within your app, issue an HTTP POST to:

https://graph.facebook.com/FOLLOWER_UID/og.follows

The FOLLOWER_UID in the above examples is the Facebook User ID of the person doing the following. You can use the alias 'me' to use the user as identified by the access token. To follow the activity of a user in your app, issue an HTTP POST to:

https://graph.facebook.com/me/og.follows

with a profile field which points to a Facebook User ID or a URL to a OG profile:

profile=8903343

or

profile=https://www.facebook.com/ola

The profile URL doesn't have to be a facebook.com URL. For example:

profile=http://www.rottentomatoes.com/celebrity/tom_hanks/

In this case, the document returned by fetching the URL should have a og:type meta tag whose value is profile and fb:profile_id meta tag which represents the Facebook ID of the user:

<meta property="og:type" content="profile" />
<meta property="fb:profile_id" content="lbRw_a8fwsz8u7a_-iL5bCxjJ8w" />

We recommend that the content of the fb:profile_id field be the third_party_id of a user, which can be retrieved by adding ?fields=third_party_id to the request URL when retrieving the user's information, and described in the documentation for the Graph API User object.

The fb:profile_id field is not required, and follow actions will succeed without it, though followers will not see activity in their News Feeds without this.

If the follow operation succeeds, a subscription ID will be returned:

{
  "id": "10101357697814503"
}

Reading Follow Actions

Your app can read the users that someone is following by issuing an HTTP GET to

https://graph.facebook.com/FOLLOWER_ID/og.follows

For the FOLLOWER_ID, you can also substitute the alias me as a shorthand for the current user.

This returns the publishers that a user is following as a JSON encoded array:

{
  "data": [
    {
      "id": "10101394432772353", 
      "from": {
        "id": "1207059", 
        "name": "Dhiren Patel"
      }, 
      "start_time": "2012-06-27T20:40:16+0000", 
      "end_time": "2012-06-27T20:40:16+0000", 
      "publish_time": "2012-06-27T20:40:16+0000", 
      "application": {
        "id": "138483919580948", 
        "name": "Social Cafe"
      }, 
      "data": {
        "profile": {
          "id": "1681", 
          "url": "https://www.facebook.com/boz", 
          "type": "profile", 
          "title": "Boz"
        }
      }, 
      . . . 

Notifications and Stories

When a user follows another user of your app, the follower will get an entry in their Recent Activity box:

The follower will also see a notification informing them that they followed someone in your app:

NOTE: This notification is only sent if the META tag for fb:profile_id is supplied, as described above, and if the follower has already installed your app.

If User A and User B are friends, then following one another will make no new content eligible for display in their News Feeds. In this case, the follower will not get a notification, but there will still be an entry in the follower's Recent Activity box on Timeline.

Following requires the publish_actions permission.

Once a user is following, she will see stories in her ticker and news feed when the publisher takes an action in your app:

Once someone follows another user (the publisher), the publisher will appear in the subscribedto tab at https://www.facebook.com/<username>/subscribedto (aside from terminology, following works identically to subscribing).

People can 'like' or 'comment' on posts by people they follow, just as they can for subscriptions on facebook.com. Followers may only comment on a post if the person who published the post has enabled comments to all subscribers.

Un-Following

You can unfollow a user by issuing an HTTP DELETE to the subscription ID. For example:

https://graph.facebook.com/10101357697814503

This will return true if the delete succeeds, or an error otherwise.