【问题标题】:Facebook API "from" field missing in page feed页面提要中缺少 Facebook API“发件人”字段
【发布时间】:2019-12-09 13:34:08
【问题描述】:

我正在开发一个需要阅读 facebook 页面帖子的程序。我已经获得了一个永久页面令牌,我可以通过 API 资源管理器中的“debug_token”端点运行它,并且可以看到我有一个没有过期的页面令牌,“manage_pages”和所有相关页面权限:

    "data": {
      "app_id": "xxxxxxxxxxxxxxxx",
      "type": "PAGE",
      "application": "Second",
      "data_access_expires_at": 1583432075,
      "expires_at": 0,
      "is_valid": true,
      "issued_at": 1575649224,
      "profile_id": "yyyyyyyyyyyyyyy",
      "scopes": [
        "user_events",
        "email",
        "read_insights",
        "manage_pages",
        "pages_manage_cta",
        "pages_manage_instant_articles",
        "pages_show_list",
        "publish_pages",
        "read_page_mailboxes",
        "ads_management",
        "ads_read",
        "business_management",
        "pages_messaging",
        "pages_messaging_phone_number",
        "pages_messaging_subscriptions",
        "publish_to_groups",
        "groups_access_member_info",
        "public_profile"
      ],

    ...

使用同一个令牌,我查询 /{page_id}/feed 并得到一个没有“来自”字段的响应:

  "data": [
    {
      "id": "xxxxxxxxxxxxxxx_yyyyyyyyyyyyyyy",
      "created_time": "2019-12-05T20:24:24+0000",
      "message": "Bla bla bla"
    },
    {
      "id": "xxxxxxxxxxxxxxx_yyyyyyyyyyyyyyy",
      "created_time": "2019-11-20T18:17:54+0000",
      "message": "Bla bla bla"
    }

    ...

即使我在字段中明确请求“来自”,我也不会将其取回,并且 API 资源管理器在左侧显示该字段呈灰色,并显示工具提示:“字段为空或访问令牌不允许”。

显然“发件人”字段不为空,这是不允许的。我知道在大多数情况下这是受保护的信息,但“提要”端点文档说

公开身份信息 - 除非您使用主页访问令牌发出请求,否则用户信息不会包含在响应中。

https://developers.facebook.com/docs/graph-api/reference/v5.0/page/feed

因此,对于作为这些帖子接收者的页面,此请求是使用页面访问令牌完成的。顺便说一句,我自己用另一个香草帐户做这些帖子,没有调整权限或隐私选项。希望帖子的来源知道您在与谁交谈似乎是合理的,对吧?

我已经搜索并尝试了其他回复,但答案有些陈旧,而且 facebook API 中的规则确实经常更改,所以这一切都是新鲜的(截至 2019 年 12 月)。

我要补充的最后一点是,此页面和应用程序未与业务经理帐户相关联。从我读到的内容来看,这对于我正在尝试做的事情来说不是必需的。

谢谢。

Debug infor on token

Missing from field from feed

【问题讨论】:

    标签: facebook facebook-graph-api


    【解决方案1】:

    好的,我自己想通了。希望答案可以帮助处于类似情况的其他人。

    问题是我的应用程序处于“开发”状态,这是正确的。根据以下来自 FB 的安全文件:

    • 应用用户只能访问在应用中具有角色的用户的数据。

    https://developers.facebook.com/docs/apps/security/

    这一额外的保护层使我的应用无法看到谁直接在其关联页面上发帖。

    我在应用程序上为发布帐户指定了“测试员”角色,现在响应具有预期的 from 字段:

      "data": [
    {
      "id": "xxxxxxxxxxxxxxx_yyyyyyyyyyyyyyy",
      "created_time": "2019-12-05T20:24:24+0000",
      "from": {
        "name": "Poster Name",
        "id": "zzzzzzzzzzzzzzz"
      },
      "message": "Bla bla bla"
    },
    {
      "id": "xxxxxxxxxxxxxxx_yyyyyyyyyyyyyyy",
      "created_time": "2019-11-20T18:17:54+0000",
      "from": {
        "name": "Poster Name",
        "id": "zzzzzzzzzzzzzzz"
      },
      "message": "Bla bla bla"
    }
    ...
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-01-24
      • 2017-03-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多