Reputation: 1230
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.
Upvotes: 1
Views: 2162
Reputation: 47966
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
And some custom ones that I manually created -
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.
Upvotes: 5