Search code examples
ruby-on-railsrubyfacebookfacebook-graph-apifb-graph

Rails: Facebook API - how to get list of groups, where I am included?


I am using FbGraph for getting information about pages I like, friends and so on, but I don't see there an option to get a list of user's groups.

Is there any way to retrieve it?

Thanks


Solution

  • In order to read user's or friends groups you must have user_groups or friends_groups permissions.

    https://graph.facebook.com/me/groups
    

    this api call will return an array of objects containing the version(old-0 or new Group-1), name, id, administrator (if user is the administrator of the Group) and bookmark_order(at what place in the list of group bookmarks on the homepage, the group shows up for the user).

    Checkout this Client Side Example page, Here testAPI() function currently getting user's name

    FB.api('/me/groups', function(response) {
        console.log('Good to see you, ' + response.data + '.');
    });