Interacting with Viewers

You can use the Live Video API to get live video comments and reactions so that video producers and on-air talent can interact with viewers. You can do this by periodically querying the live video object to get current comments and reactions, or set up Server-Sent Events to receive real-time comments and reactions.

Getting Current Comments and Reactions

To get the current comments or reactions on a live video, send a GET request to the LiveVideo object's /comments or /reactions edge.

Sample Request

curl -i -X GET \
  "https://graph.facebook.com/{live-video-id}/comments
    ?access_token={page-access-token}"
GraphRequest request = GraphRequest.newGraphPathRequest(
  accessToken,
  "/{live-video-id}/comments",
  new GraphRequest.Callback() {
    @Override
    public void onCompleted(GraphResponse response) {
      // Insert your code here
    }
});

request.executeAsync();
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
    initWithGraphPath:@"/{live-video-id}/comments"
           parameters:nil
           HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
    // Insert your code here
}];
FB.api(
  '/{live-video-id}/comments',
  'GET',
  {},
  function(response) {
      // Insert your code here
  }
);
try {
  // Returns a `FacebookFacebookResponse` object
  $response = $fb->get(
    '/{live-video-id}/comments',
    '{access-token}'
  );
} catch(FacebookExceptionsFacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(FacebookExceptionsFacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}
$graphNode = $response->getGraphNode();

Sample Response

{
  "data": [
    {
      "created_time": "2018-08-30T18:47:02+0000",
      "from": {
        "name": "Steph C.",
        "id": "552524095105158"
      },
      "message": "This is such a great live stream.",
      "id": "911936075671494_911936769004758"
    },
    {
      "created_time": "2018-08-30T18:47:17+0000",
      "from": {
        "name": "Kevin D.",
        "id": "552524095105158"
      },
      "message": "Shoutout over here!",
      "id": "911936075671494_911936909004744"
    },
    {
      "created_time": "2018-08-30T18:48:14+0000",
      "from": {
        "name": "Clay T.",
        "id": "552524095105158"
      },
      "message": "Where is this place?",
      "id": "911936075671494_911937292338039"
    }
    ],
  "paging": {
    "cursors": {
      "before": "WTI5d...",
      "after": "WTI5d..."
    }
  }
}

Refer to the Live Video Comments reference and the Live Video Reactions reference for information on returnable fields, and filtering and ordering instructions. Comments and reactions can be polled every few seconds.

Receiving Real-time Comments and Reactions

To receive comments and reactions in browser clients in real-time, set up Server Sent Events and send GET requests to the /live_comments and /live_reactions edges on the LiveVideo node.

Note that the host URL for streaming events is: https://streaming-graph.facebook.com

Sample Request

GET https://streaming-graph.facebook.com/{live-video-id}/live_comments
      ?access_token={access-token}
var source = new EventSource("https://streaming-graph.facebook.com/{live-video-id}/live_comments?access_token={page-access-token}");
source.onmessage = function(event) {
  // Do something with event.message for example
};

Sample Response

: ping
data:
  {
    "created_time":"2018-08-30T21:11:01+0000",
    "id":"911936075671494_912014908996944",
    "view_id":43329028,
    "from":
      {
        "id":"552524095105158",
        "name":"Kerry Fisher"
      },
    "message":"I love this video!"
  }
: ping
: ping

Refer to the Live Comments and Live Reactions references to information on returnable fields, ping frequency, and filtering.

Boosting Engagement

As soon as a live video begins streaming, Page followers will receive a notification indicating that a Page they are following has gone live. Below are some tips to improve reach.

  • Encourage users to Like or Follow your page.
  • Encourage your followers to Subscribe to live video notifications.
    • New Live Posts — Subscribers will receive all live video notifications.
    • Suggested — Subscribers will receive suggested live video notifications for this page. These are determined by the individual subscriber's previous interactions with the page's live videos. This is the default setting for anyone who follows a page.
    • Off — Subscribers will not receive live video notifications.
  • Encourage your followers to Subscribe to live video notifications.

Note that continuous live posts do not send notifications, even to followers of a page. For more information on continuous live, please see our continuous live documentation.

Subscribers will not receive notifications if:

  • they are not a fan of the page
  • they are a fan of the page, but the post is from a brand page
  • they have received too many live notifications in the last 24 hours