既然publish_actions权限已被弃用,如何使用API​​作为Facebook页面发布? (自2018年4月24日起)

既然publish_actions权限已被弃用,如何使用API​​作为Facebook页面发布? (自2018年4月24日起)

问题描述:

我已经阅读了几本有关如何通过Python API撰写Facebook帖子的教程. 此链接上的文档指出-

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

自2018年4月24日起,pubish_actions权限已被删除.请参阅突破性更改Changelog 更多细节.为了为您的应用程序用户提供一种与Facebook共享内容的方式,我们建议您使用我们的共享产品代替.

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.

仍然遵循以下步骤:

  1. 创建了一个Facebook应用
  2. 生成了一个具有无限期限的长期访问令牌,该令牌具有我可以授予应用程序的所有可能的权限(manage_pages,pages_manage_cta,pages_show_list,pages_messaging,pages_messaging_phone_number,pages_messaging_subscriptions,public_profile)

尝试使用Graph API Explorer工具请求publish_pages会导致此错误-

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

无效范围:publish_pages.此消息仅显示给开发人员.您的应用程序用户将忽略这些权限(如果存在).请在以下位置阅读文档以获取有效权限: https://developers.facebook.com/docs /facebook-login/permissions

  1. 尝试使用图形API请求创建帖子:

  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 -

由于已弃用必需的权限manage_pages,publish_pages,因此不建议使用此端点

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

现在不赞成使用publish_pages权限,如何使用API​​将帖子发布为Facebook页面?

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

您需要研究新的API和权限manage_pagespublish_pages,您可以在文档

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.