How mark a Facebook notification as read via Facebook API?

喜夏-厌秋 提交于 2019-11-28 05:44:19

问题


I have managed to get a list of new Facebook Notifications but can't seem to find a way of marking them as read?

I am using FQL with the PHP SDK.

Please can someone point me to some documentation with examples.


回答1:


To mark a notification as read, POST to

graph.facebook.com/NOTIFICATION_ID 

with param "unread"=0.

If you've received the notification object via Grapth API, NOTIFICATION_ID equals the id of the notification object.

If you've received the notification object via FQL, you'll have to build NOTIFICATION_ID as follows:

"Notif_" + userId + "_" + notification_id.

For example if current userId is 123 and notification_id from FQL is 456, NOTIFICATION_ID should be:

notif_123_456 

and the POST becomes:

graph.facebook.com/notif_123_456

with parameter unread=0

You'll need 'manage_notifications' permission.




回答2:


To read notifications, you will need to get manage_notifications permission from the user. (Presuming you already have that is you can getList).

To mark a notification as read you need to use:

notifications.markRead

You can find information on this page.

http://developers.facebook.com/docs/reference/rest/notifications.markRead/

You cannot use straight FQL to mark a notification as read and you can only mark notifications that have been created (as I am led to believe) during the current user session.



来源:https://stackoverflow.com/questions/8263262/how-mark-a-facebook-notification-as-read-via-facebook-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!