This document shows you how you can use the Live Video API to post videos simultaneously to multiple pages.
Crossposting is not available for personal profiles, but for pages and professional profiles only. Crossposting is also available for VOD videos in addition to live videos.
To crosspost live videos to multiple pages and professional profiles, and VOD, you will need to do the following:
CREATE_CONTENT
task on the Pagepages_manage_posts
pages_read_user_content
pages_manage_engagement
pages_show_list
publish_video
In order to crosspost to another page or professional profile, your page must send a crossposting request to a page or professional profile, and the invited page or profile must accept your request.
To send a crosspost request, send a POST
request to the /<YOUR_PAGE_ID>
endpoint with the following parameters:
begin_crossposting_handshake
set to an array with a comma separated list of pages where partner_page_id
is set to the Page ID to which you are sending the request and allow_live
set to true
When testing an API call, you can include the access_token
parameter set to your access token. However, when making secure calls from your app, use the access token class.
curl -i -X POST "https://graph.facebook.com/v21.0
<PAGE_1_ID> \
?begin_crossposting_handshake=[{partner_page_id:<PAGE_2_ID>,allow_live:true}]"
On success, your app receives a JSON response with success
set to true
.
{ "success": true }
Set allow_live
to false
to send a request to create a crossposting relationship wherein a Page can crosspost live videos to your Page only after your admins or editors have approved the video.
To accept a request from another page to crosspost their video to your page, send a POST
request to the /<ID>
endpoint with the accept_crossposting_handshake
parameter set to the Page ID who sent the request and allow_live
to true
.
curl -X POST "https://graph.facebook.com/v21.0
/<PAGE_2_ID>
?accept_crossposting_handshake=[{partner_page_id:<PAGE_1_ID>, allow_live:true}]"
On success, your app receives a JSON response with success
set to true
. The video will now be live on multiple pages.
To deny a request, set allow_live
to false
.
To find pages that your app user has permission to crosspost to, send a GET
request to the /<PAGE_ID>/crosspost_whitelisted_pages
endpoint with the following fields:
allows_live_crossposts
id
name
(optional)
curl "https://graph.facebook.com/v21.0
/<PAGE_ID>/crosspost_whitelisted_pages" \
-d "fields=id,name,allows_live_crossposts"
On success your app will receive a list of IDs, names, and whether or not the Page is allowed to crosspost, true
or false
. true
means the source page can post the crossposted live video directly to the target page without further authorization. false
means the target page must manually post the crossposted video.
{ "data": [ { "id": "107738621396466", "name": "Crossposting Page C", "allows_live_crossposts": false }, { "id": "106589754846067", "name": "Crossposting Page B", "allows_live_crossposts": true }, { "id": "106343288214714", "name": "Crossposting Target X", "allows_live_crossposts": true, } ], "paging": { "cursors": { "before": "<PAGE_CURSOR>", "after": "<PAGE_CURSOR>" } } }
A user must be able to act on behalf of a page, and must be able to edit and update videos. That means, your app will need to have pages_manage_posts
permission on behalf of your user.
Once we know which pages are available for crossposting, we can add crossposting_actions
to any LiveVideo object. Each crossposting action defines whether a live video is made available for crossposting, and if it should automatically post to the target page.
The request is POST /{video-id}
to update a video.
curl -i -X POST \
"https://graph.facebook.com/v10.0/112103234301221?fields=crosspost_shared_pages,crossposted_broadcasts%7Bstatus,from%7Bname%7D%7D&access_token=${access_token}" \
-H "Content-Type: application/json" \
-d @- << HEREDOC
{"crossposting_actions": [
{
"page_id": "107738621396466",
"action": "enable_crossposting"
},
{
"page_id": "106589754846067",
"action": "enable_crossposting_and_create_post"
},
{
"page_id": "106343288214714",
"action": "disable_crossposting"
}
]}
HEREDOC
These actions show the options available. The first would allow the first page (107738621396466
) to crosspost the video from Creator Studio, or the API, but would not automatically crosspost the video anywhere. The second would prevent the second page (106589754846067
) from crossposting the video, and the third would automatically post the video to the targeted page (106343288214714
).
Returns the LiveVideo object, and we've used the crosspost_shared_pages
edge to see which pages have it available, and the crossposted_broadcasts
edge to see the pages where our posts have already posted.
If any crossposting relationships have changed or are invalid, the crossposts will obviously not succeed, but no error will be thrown. That means inspecting the response for successful broadcasts is the only way to know if an action has succeded or not.
{ "crosspost_shared_pages": { "data": [ { "name": "Crossposting Page C", "id": "107738621396466" }, { "name": "[FB Test Page] Crossposting Page B", "id": "106589754846067" } ] }, "crossposted_broadcasts": { "data": [ { "status": "UNPUBLISHED", "from": { "name": "[FB Test Page] Crossposting Page B", "id": "106589754846067" }, "id": "114820814022961" } ] }, "id": "112103234301221" }
If any crossposting_options
are invalid, the entire request will fail. No crossposts will succeed.
{ "error": { "message": "Fatal", "type": "OAuthException", "code": -1, "error_subcode": 1363103, "is_transient": false, "error_user_title": "Invalid Parameters", "error_user_msg": "The request does not specify valid parameters, no action has been taken.", "fbtrace_id": "AnI03n5n0Px-ihrZjkWMeTP" } }