我一直在尝试阅读用户的Facebook通知。
图表返回的通知的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只能带我到目前为止,因为有很多可能的权限组合,尝试每个组合可能需要几个生命周期。
感谢您的投入!
答案 0 :(得分:0)
这似乎是一个奇怪的组合,但这里是两个权限(显然除了manage_notifications
)我发现它使它工作。你必须同时拥有它们。
user_groups
read_stream
我不知道这些特定权限是什么,但是反复试验让我想到了这种组合。