How mark a Facebook notification as read via Faceb

2019-01-26 21:39发布

问题:

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.