You can use the API to create and manage polls on live video broadcasts that have a status of LIVE. Polls are represented by VideoPoll objects and are comprised of VideoPollOptions, which represent possible answers to the poll question.
To create a poll on a live video broadcast, send a request to:
POST /{live-video-id}/polls?question={question}&options={options}
The targeted LiveVideo object must have a status of LIVE in order for the VideoPoll to be created. Upon success, the API will respond with the VideoPoll object's ID.
{question} — The poll question.{options} — An array of possible answers.Refer to the Live Video Polls edge reference for a complete list of query string parameters you can include when creating a poll.
| Type | Description |
|---|---|
An access token of a User or Page who created the LiveVideo. | |
For a VideoPoll on a LiveVideo on a Group: | |
For a VideoPoll on a LiveVideo on a User: For a VideoPoll on a LiveVideo on a Page: For a VideoPoll on a LiveVideo on a Group: |
curl -i -X POST \
"https://graph.facebook.com/v3.3/10214959467675612/polls
?question=What%20kind%20of%20bear%20is%20best%3F
&options=%5B%22Black%20bear%22%2C%20%22Brown%20bear%22%2C%20%22That's%20a%20ridiculous%20question%22%5D
&access_token={access-token}"{
"id": "2318567914888258" // VideoPoll ID
}To close a poll on a live video broadcast after a person has selected a poll option, send a request to:
POST /{video-poll-id}?action=CLOSE
| Type | Description |
|---|---|
For a VideoPoll on a LiveVideo on a Group: | |
For a VideoPoll on a LiveVideo on a User: For a VideoPoll on a LiveVideo on a Page: For a VideoPoll on a LiveVideo on a Group: |
curl -i -X POST \
"https://graph.facebook.com/{video-poll-id}?action=CLOSE&access_token={access-token}"{
"success": true
}To reopen a closed poll so a person can change their poll option, send a request to:
POST /{video-poll-id}?action=SHOW_VOTING
| Type | Description |
|---|---|
An access token of a User who created the VideoPoll. | |
For a VideoPoll on a LiveVideo on a Group: | |
For a VideoPoll on a LiveVideo on a User: For a VideoPoll on a LiveVideo on a Page: For a VideoPoll on a LiveVideo on a Group: |
curl -i -X POST \
"https://graph.facebook.com/{video-poll-id}
?action=SHOW_VOTING
&access_token={access-token}"{
"success": true
}To configure a poll to display results after a person has voted, send a request to:
POST /{video-poll-id}?action=SHOW_RESULTS
| Type | Description |
|---|---|
An access token of a User who created the VideoPoll. | |
For a VideoPoll on a LiveVideo on a Group: | |
For a VideoPoll on a LiveVideo on a User: For a VideoPoll on a LiveVideo on a Page: For a VideoPoll on a LiveVideo on a Group: |
curl -i -X POST \
"https://graph.facebook.com/{video-poll-id}
?action=SHOW_RESULTS
&access_token={access-token}"{
"success": true
}To get a poll's possible answers, send a request to:
GET /{video-poll-id}?fields=poll_options
GET /{video-poll-id}/poll_options
Refer to the VideoPoll reference for a list of available fields and edges.
| Type | Description |
|---|---|
An access token of a User who created the VideoPoll. | |
For a VideoPoll on a LiveVideo on a Group: | |
For a VideoPoll on a LiveVideo on a User: For a VideoPoll on a LiveVideo on a Page: For a VideoPoll on a LiveVideo on a Group: |
Gets a poll's possible answers:
curl -i -X GET \
"https://graph.intern.facebook.com/{video-poll-id}/poll_options
?fields=poll_options
&access_token={access-token}"An object containing a list of possible answers (a list of VideoPollOptions).
{
"poll_options":
{
"data": [
{
"text": "Brown bear",
"id": 145049637
},
{
"text": "Black bear",
"id": 145049638
}
{
"text": "That is a stupid question",
"id": 145049639
}
{
"text": "Basically, there are two schools of thought",
"id": 145049640
}
]
},
"id": 12345
}To get the number of votes on a poll option, send a request to:
GET /{video-poll-option-id}?fields=total_votes
| Type | Description |
|---|---|
An access token of a User who created the VideoPollOption. | |
For a VideoPoll on a LiveVideo on a Group: | |
For a VideoPoll on a LiveVideo on a User: For a VideoPoll on a LiveVideo on a Page: For a VideoPoll on a LiveVideo on a Group: | |
The same access token used to create the LiveVideo or Broadcast. |
curl -i -X GET \
"https://graph.facebook.com/{video-poll-option-id}
?fields=total_votes
&access_token={access-token}" {
"total_votes": 129,
"id": "{video-poll-option}"
}To get the number of votes for each of the possible answers on a poll, use field expansion on the poll_options field to have the response include the total_votes field on any VideoPollOptions that are returned:
GET /{video-poll-id}?fields=poll_options{total_votes}
| Type | Description |
|---|---|
An access token of a User who created the LiveVideo. | |
For a VideoPoll on a LiveVideo on a Group: | |
For a VideoPoll on a LiveVideo on a User: For a VideoPoll on a LiveVideo on a Page: For a VideoPoll on a LiveVideo on a Group: |
Gets all of the VideoPollOptions and their text and total_votes fields on a VideoPoll.
curl -i -X GET \
"https://graph.intern.facebook.com/{video-poll-id}
?fields=poll_options{text,total_votes}
&access_token={access-token}"{
"poll_options":
{
"data": [
{
"text": "Brown Bear",
"total_votes": 12,
"id": 145049637
},
{
"text": "Black Bear",
"total_votes": 87,
"id": 67890
}
{
"text": "That's a stupid question",
"total_votes": 45,
"id": 145049639
}
{
"text": "Basically, there are two schools of thought",
"total_votes": 12,
"id": 145049640
}
]
},
"id": 12345
}