Surdeep Singh
Surdeep Singh

Reputation: 9

How can I post as a Facebook page using API now that publish_actions permission has been deprecated? (since April 24, 2018)

I've read several tutorials on how to make a Facebook post via Python API. Documentation on this link states that -

As of April 24,2018, the pubish_actions permission has been removed. Please see the Breaking Changes Changelog for more details. To provide a way for your app users to share content to Facebook, we encourage you to use our Sharing products instead.

Still followed the steps:

  1. Created a Facebook app
  2. Generated a long-lived access token with no expiry limit having all possible permissions I could give to the app (manage_pages, pages_manage_cta, pages_show_list, pages_messaging, pages_messaging_phone_number, pages_messaging_subscriptions, public_profile)

Attempting to Request publish_pages using Graph API Explorer tool leads to this error -

Invalid Scopes: publish_pages. This message is only shown to developers. Users of your app will ignore these permissions if present. Please read the documentation for valid permissions at: https://developers.facebook.com/docs/facebook-login/permissions

  1. Attempted to create a post using the graph API request:

    curl -i -X POST \
     -d "url=https://www.facebook.com/images/fb_icon_325x325.png" \
     -d "caption=test photo upload" \
     -d "access_token=<user_photos_user_access_token>" \
     "https://graph.facebook.com/v3.0/me/photos"
    

This request leads to the following error message -

This endpoint is deprecated since the required permissions manage_pages,publish_pages are deprecated

Now that publish_pages permission is deprecated, how do I publish a post as a Facebook page using API?

Upvotes: 1

Views: 2486

Answers (1)

Gricey
Gricey

Reputation: 1441

You'll need to look into the newer API and permissions manage_pages and publish_pages which you can see in the docs here.

You need both these permissions to post as a page. Also you need to go through an app review process to get these permissions which is detailed on the pages docs.

Edit to answer additional question in comments: As it says in the linked docs, the tokens expire after an hour and you must request a new one. See bottom of tokens page.

Upvotes: 1

Related Questions