You can use the Live Video API to get comments and reactions on live video broadcasts so that video producers and on-air talent can interact with viewers. You can do this by periodically querying the LiveVideo object to get current comments and reactions, or set up Server-Sent Events to receive real-time comments and reactions.
To get the current comments or reactions on a live video broadcast, send a request to:
GET /{live-video-id}/comments
GET /{live-video-id}/reactions
curl -i -X GET \
"https://graph.facebook.com/{live-video-id}/comments?access_token={access-token}"
{ "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 Comments and Reactions edge references for information on returnable fields, and filtering and ordering instructions. Comments and reactions can be polled every few seconds.
To receive comments and reactions in browser clients in real-time, set up Server Sent Events and send a request to these endpoints:
GET /{live-video-id}/live_comments
GET /{live-video-id}/live_reactions
Note that the host URL for streaming events is: https://streaming-graph.facebook.com
GET https://streaming-graph.facebook.com/{live-video-id}/live_comments?access_token={access-token}
: 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 for information on returnable fields, ping frequency, and filtering.