You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过Facebook Graph API获取页面评论发布者ID

解决方案:获取Facebook评论发布者ID并完成评论回复

核心解决路径

因为v19.0版本的/ratings接口不再提供reviewer字段,你可以从已请求的open_graph_story字段中提取评论发布者ID——具体取open_graph_story.from.id的值即可。

具体操作步骤

  1. 调整ratings接口的请求字段
    为确保返回的open_graph_story包含发布者信息,修改请求的fields参数,明确指定open_graph_story.from:

    https://graph.facebook.com/v19.0/{pageId}/ratings?fields=created_time%2crecommendation_type%2creview_text%2copen_graph_story%7bfrom%7d&access_token={token}
    

    URL解码后的fields参数为:created_time,recommendation_type,review_text,open_graph_story{from}

  2. 从返回数据中提取posterId
    接口返回的每条rating数据里,open_graph_story.from.id就是评论发布者的ID(即你需要的posterId)。示例返回结构如下:

    {
      "data": [
        {
          "created_time": "2024-05-20T12:34:56+0000",
          "recommendation_type": "positive",
          "review_text": "Great service!",
          "open_graph_story": {
            "from": {
              "id": "100012345678901",
              "name": "John Doe"
            }
          },
          "id": "PAGE_ID_RATING_ID"
        }
      ]
    }
    

    这里的100012345678901就是posterId,PAGE_ID_RATING_ID是recommendationId。

  3. 构造评论回复请求
    用{posterId}_{recommendationId}作为节点ID,发送POST请求到评论接口:

    https://graph.facebook.com/v19.0/{posterId}_{recommendationId}/comments?access_token={token}&message={你的回复内容}
    

关键注意点

  • 你的access_token必须拥有pages_manage_engagement权限,这是回复评论的必要权限。
  • 如果open_graph_story未返回from信息,检查权限是否达标,或确认该rating对应的公开内容是否允许获取发布者信息。

内容的提问来源于stack exchange,提问作者StanLachie

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.29 14:30:09