Graph:Subscription

From Facebook Developer Wiki (FbDevWiki.com)
Jump to: navigation, search

A subscription to an application to get real-time updates for an Graph object type. For more details, see the Real-time Overview.

Example

https://graph.facebook.com/APP_ID/subscriptions

Properties

Name Description Permissions Returns Condition
object The object type to subscribe to Available to everyone in Facebook by default A JSON string containing code or permissions
fields The list of fields for the object type Available to everyone in Facebook by default A JSON string containing a comma-seperated list of field names
callback_url An endpoint on your domain which can handle the real-time notifications Available to everyone in Facebook by default A JSON string containing a valid URL
active Whether or not the subscription is active or not Available to everyone in Facebook by default A JSON boolean

Publishing

To create a subscription, issue a POST request with the object, fields and callback_url to the application/subscriptions connection.

curl https://graph.facebook.com/APP_ID/subscriptions \
     -F 'access_token=...' \
     -F 'object=user' \
     -F 'fields=activities,friends,feed' \
     -F 'callback_url=http://www.site.com/callback.php' \
     -F \
     'verify_token=a_secret_you_want_echoed'
Personal tools
Namespaces
Variants
Actions
Navigation
Graph API
FQL
Toolbox