2

我一直在做很多实验来阅读用户的 Facebook 通知。

Graph 返回的通知的 JSON 包含一个object字段。我的问题是:我的应用需要什么权限才能使该字段不为空?

一些背景

我要解决的问题是为用户提供类似电子邮件的 Facebook 通知视图。我想显示评论本身,而不是只显示“用户对您的帖子发表评论”。发送请求/notifications将返回具有object字段的 JSON:

{
  "id": "notif_XXXXXXXX_373403974", 
  "from": {
    "name": "Michael XXXXX", 
    "id": "XXXXXXXX"
  }, 
  "to": {
    "name": "Josaphat Valdivia", 
    "id": "XXXXXXXX"
  }, 
  "created_time": "2013-03-10T19:46:38+0000", 
  "updated_time": "2013-03-10T19:46:38+0000", 
  "title": "Michael XXXXXXX posted in Pie on Pi!: \"I'm assuming cheesecake counts as pie.\"", 
  "link": "http://www.facebook.com/events/119151878267920/123715204478254/", 
  "application": {
    "name": "Events", 
    "id": "141157392619610"
  }, 
  "unread": 0, 
  "object": null
},

不幸的是,这个领域似乎主要是null. 但是,如果我授予我的应用程序几乎所有权限,则该字段将由我称之为“源对象”的内容填充:

{
  "id": "notif_XXXXXXX_373368858", 
  "from": {
    "name": "Carly XXXXXX", 
    "id": "XXXXXXX"
  }, 
  "to": {
    "name": "Josaphat Valdivia", 
    "id": "XXXXXXXX"
  }, 
  "created_time": "2013-03-10T15:48:44+0000", 
  "updated_time": "2013-03-10T15:48:44+0000", 
  "title": "Carly XXXXXXX updated her status: \"yes yes concert yesssssssss\"", 
  "link": "http://www.facebook.com/XXXXXX/posts/10151810126992926", 
  "unread": 0, 
  "object": {
    "id": "XXXXXXX_10151810126992926", 
    "from": {
      "name": "Carly XXXXX", 
      "id": "XXXXXXXX"
    }, 
    "message": "yes yes concert yesssssssss", 
    "actions": [
      {
        "name": "Comment", 
        "link": "https://www.facebook.com/XXXXXXX/posts/10151810126992926"
      }, 
      {
        "name": "Like", 
        "link": "https://www.facebook.com/XXXXXXX/posts/10151810126992926"
      }
    ], 
    "privacy": {
      "value": ""
    }, 
    "type": "status", 
    "status_type": "mobile_status_update", 
    "created_time": "2013-03-10T15:48:43+0000", 
    "updated_time": "2013-03-10T15:48:43+0000", 
    "likes": {
      "data": [
        {
          "name": "Jenna XXXXXXX", 
          "id": "XXXXXXXXX"
        }, 
        {
          "name": "Kymberlee XXXXXXXX", 
          "id": "XXXXXXX"
        }, 
        {
          "name": "Lori XXXXXX", 
          "id": "XXXXXXX"
        }, 
        {
          "name": "Andreas XXXXXXXX", 
          "id": "XXXXXXX"
        }
      ], 
      "count": 6
    }, 
    "comments": {
      "count": 0
    }
  }
},

请注意,在此代码段中,该object字段包含有关帖子的所有信息,包括操作、喜欢和评论。

这个问题让我大吃一惊:尝试使用 Graph Explorer 只能让我走这么远,因为有太多可能的权限组合,尝试每种组合可能需要好几个生命周期。

感谢您的输入!

4

1 回答 1

0

这似乎是一个奇怪的组合,但这是manage_notifications我发现的两个权限(显然除外),可以使它工作。你必须同时拥有它们。

user_groups

read_stream

我不知道这些特定权限是什么,但反复试验使我得到了这种组合。

于 2013-03-15T02:32:00.863 回答