Real-Time API for Pages
With Real-Time API, your app can subscribe to updates in certain pieces of data. When a change occurs, the API sends an HTTP 'POST' request to a callback URL you set up for your app.
For Pages, you don't need to constantly poll a page for changes such as new posts or Page reviews; the Real-Time API can tell your app when a Page's information changes and when you need to make changes to a Page.
Your app can get updates for any Page related change in Graph API including messages sent to a page and reading page posts. This is useful if you have SLAs which require you to report when someone contacts a Page.
Set Up a Callback URL
First you'll need to prepare the page that will act as your callback URL. This URL must be accessible by Facebook servers, and can receive POST data sent when an update happens, and can receive GET requests in order to verify subscriptions.
For instructions see Graph API, Advanced, Setting Up your Callback URL.
Subscribe to Updates
- Add or modify a subscription.
- List each of your existing subscriptions.
- Delete subscriptions.
Note that subscriptions to some updates may require that you get your app whitelisted. For the full Page reference, see Graph API Reference, Page.
Subscribe to Page Posts
Your app can subscribe to a Page's conversations and get notification anytime someone sends a message to a Page:
use Facebook\FacebookSession; use Facebook\FacebookRequest; $session = new FacebookSession('<APP_ACCESS_TOKEN>'); $request = new FacebookRequest( $session, 'POST', '/<APP_ID>/subscriptions', array( 'object' => 'page', 'callback_url' => '<YOUR_CALLBACK_URL>', 'fields' => 'conversations', 'verify_token' => '<YOUR_VERIFY_TOKEN>', ) ); $response = $request->execute();
The parameters used in the call:
The URL that will receive the
An arbitrary string that can be used to confirm to your server that the request is valid.
This is an application access token.
After a Page receives a new post, your callback URL gets a response similar to the following:
Array ( [object] => page [entry] => Array (  => Array ( [uid] => 626011956865 [id] => 626011956865 [time] => 1418284857 [changes] => Array (  => Array ( [field] => conversations [value] => Array ( [page_id] => 518157959452399, [conversation_id] => 93054285730295240750, ) ) ) ) ) )
The following subscriptions and actions are available for Page. Note that these actions are subject to change.
Promotable_posts endpoint- You can subscribe and filter updates by
Promotable posts- Subscribe to promotable_posts updates created using
Supported Actions and Subscription Updates:
- Deleted Post in feed
- New Like/Unlike on a Post in feed
- New Comment on a Post in feed
- New Reply on a Comment in feed
- Edited existing Comment on a Post
- Edited existing Reply on a Comment
- Deleted Comment on a Post
- Deleted Reply on a Comment
- New Like/Unlike on a Comment
- New Like/Unlike on a Reply
- Edited existing Post in feed
Not available for Page Posts RTU:
- New Share on a Post in feed
conversations endpoint of Page object:
- New Message in Page Inbox from a User
- New Message in Page Inbox from a Page Admin
Not available for Page
- Conversation deleted from Page Inbox
- Message deleted from Page Inbox