how can i get user notifications with the new Graph API

后端 未结 4 876
眼角桃花
眼角桃花 2020-12-29 11:20

im making switch to the new Graph API , and i try to replace all the rest api with the new Graph api reading the docs i saw i have some kind of real time function ( im not s

相关标签:
4条回答
  • 2020-12-29 11:39

    A GraphAPI-way: you can access notifications through USER_ID/notifications, it requires the manage_notifications permission.

    Graph API Explorer example

    0 讨论(0)
  • 2020-12-29 11:44

    If you want to get all recent notifications including read notifications via Graph API, call:

    graph.facebook.com/USER_ID/notifications?include_read=true
    

    This can be useful for testing purposes.

    0 讨论(0)
  • 2020-12-29 11:45

    As of Aug 1 2010, there are still no methods for notifications in the new Graph API (I'm not sure if there are any plans for migrating that). You need to use the old REST API for that.

    Use FB.api in place of old REST API. It could be something like this:

    FB.api(
      {
        method: 'notifications.get'
      },
      function(response) {
        alert("Number of unread messages: " + response.messages.unread);
      }
    );
    
    0 讨论(0)
  • 2020-12-29 11:53

    Update: It is no longer possible to read the user notifications.

    https://developers.facebook.com/docs/graph-api/reference/user/notifications/

    0 讨论(0)
提交回复
热议问题