How to publish actions on facebook timeline (for facebook apps) – 2015

Publish Stories, Actions, Objects

Facebook allows users to share their experience with apps they use. Those experiences are nicely termed as Stories or Open Graph Stories

User’s interactions are called as Actions, they are the verbs in the stories. Graph API can be used to manage custom actions and predefined actions (also know as common actions).

App developers can make use of these stories to create virality to their app.

App stories requires review and approval. For testing purposes, app developers will be able to publish and view stories on their timeline.

Lets jump into how to publish actions.

You can use predefined common actions (see here for the list)

Core components to be known before setting it up

There are four core components in open graph stories

  1. App – App for which stories are published
  2. Actor – User whose story is published
  3. Object – Thing with which user interacts in the app
  4. Action – Activity user performs

Following are the steps to get your stories working with your app

1. Choose app for which you want to publish actions

https://developers.facebook.com/apps/89000000000000/open-graph/action-types

2. Create Object types

Goto Open Graph -> Object Types and Add an object type

facebook app object types

We are creating cake as an object type

facebook app add object

Singular and plural objects will be automatically created, which can be edited

facebook app new object - cake

3. Create Actions

Goto Open Graph -> Action Types and Add an action type

facebook app action types

We are creating bake as an action type

facebook app new action

Additional capabilities can be added to actions

facebook_app_action_capabilities

4. Create Stories

Now the entire experience is created as a story, create story on

Goto Open Graph -> Stories and Add Custom Story

facebook app stories

We are creating a story “bake a cake” here, which says User bakes a cake with App

facebook app create story

Automatically story perspectives and tenses will be created

facebook app new story

 

5. Actions can be published with Graph API endpoint

Finally, we got to publish this story, clicking on get code will give a code like the one below,

a. Using below URL story can be published

https://graph.facebook.com/me/{app_slug}:{action type}?
access_token=ACCESS_TOKEN&
method=POST&
cake={url with open graph tags - ex: cake specification here}

b. For PHP SDK following code can be used

$response = $facebook->;api(
'me/{appname}:{action type}',
'POST',
array(
'cake' =>; '"{Object URL}"'
)
);

Sample Object URL will look like http://samples.ogp.me/900718983337899, view source to see the open graph tags required in an object page.

Once you have created stories and used it in your app, they should be submitted for review and approval

facebook app action approval

Click on Start Submission and Add Item and submit for review

facebook app submit story

While submitting for review, you should add screenshots and instructions for the stories.

That’s all, Once Facebook approves your app’s stories, your app has that virality creating mechanism.