1

By which I mean when people can make sub lists of friends (i.e. work friends, family, close friends).

Is it possible to access these, as I would like my app to let the user target specific groups of friends to send messages to without having to manually choose each person?

Any searches for 'facebook groups', 'facebook friends groups' or 'friends list' turns up info on how to access the main friends list - which I can already do.

Has anyone managed to do this before? On the one hand I think it could be prohibited due to privacy issues, on the other hand I would think Facebook would prefer that users could message groups of friends in apps.

TheBestBigAl
  • 1,231
  • 1
  • 16
  • 42

1 Answers1

5

You can most certainly get at this data. There is a specific permission called user_friendlists. You'll have to request that permission from your users and once you have it, all you have to do is query this Graph end point -

https://graph.facebook.com/USER_ID/friendlists

It'll return data similar to this -

{
  "data": [
    {
      "id": "XXX", 
      "name": "Close Friends", 
      "list_type": "close_friends"
    }, 
    {
      "id": "YYY", 
      "name": "♥", 
      "list_type": "user_created"
    }, 
    {
      "id": "ZZZ", 
      "name": "Offline", 
      "list_type": "user_created"
    }, 
    {
      "id": "AAA", 
      "name": "The Office", 
      "list_type": "work"
    }, 
    {
      "id": "BBB", 
      "name": "Acquaintances", 
      "list_type": "acquaintances"
    }, 
    ...

As you can see, there are both types of friend lists here. Automatically generated ones such as

  • Close Friends
  • Acquaintances

And some custom ones that I manually created -

  • Offline
  • The Office

To get at the actual friends listed within these lists, you use the /members end point.

https://graph.facebook.com/USER_ID/FRIENDLIST_ID/members

This is only the read permission, you'll need the additional manage_friendlists to be able to create/edit those lists.

Lix
  • 47,311
  • 12
  • 103
  • 131
  • 1
    Thank you very much, I only need the read permission so this is great. Not sure why my earlier searches didn't turn this up.. – TheBestBigAl Aug 07 '12 at 17:25
  • I originally asked about this well in advance of starting the app, and today found out that "FRIENDLIST_ID/members" is not very reliable. Most of the time it returns an data array. Seems a few people have reported the same bug to Facebook, but there's no sign of it being fixed yet. In case anyone is confused, Lix was 100% correct that this is how you SHOULD be able to access the members of a group, the returned data is just not very reliable. – TheBestBigAl Oct 29 '12 at 18:32
  • FRIENDLIST_ID/members should work fine. But the result will be empty if you don't have the right perms, like user_relationships when querying the "Family" list. Also the results will be a partial list when people on that list have privacy settings that filter them out from the results. – Donn Lee Jan 19 '13 at 03:35
  • Getting friends list in the "members" way is not supported anymore: https://developers.facebook.com/docs/graph-api/reference/v2.0/friendlist/members – David May 25 '14 at 16:36
  • As of v2.0, this API only returns the friend lists themselves, not the list of people within each group. This API is thus primarily useful to allow you to render an audience selector when giving a person the opportunity to publish back to Facebook. – Simon Cross May 29 '14 at 07:38
  • Can you please tell me how to use the "next" pagination that it returns ? – Natesh bhat Feb 16 '18 at 01:55
  • @Nateshbhat - It is usually an entire URL that you can use as-is to fetch the next page of results. – Lix Feb 18 '18 at 09:07