简体   繁体   中英

Facebook API - App request - invites friends filter

I have found several friends filter option while invites friends from facebook App.

What will be logic behind "LIKES GAMES" that I saw at the sim social

also found some more on Zynga invites :

  1. Recommended friends

  2. My Active Zynga Friend

Not able to find any logic behind this. I build a custom friends invite plugin by using graph and FB.ui api. Here my client want to give some filter like I mentioned above.

Can someone help me on this?

Thanks Peter

From my point of view, making a filter for the invite dialog like the one from The Sim Social game is done this way:

  1. First make your app require access their likes and friend likes by asking for the permissions user_likes and friends_likes
  2. Make calls to the graph api like this one for every friend https://graph.facebook.com/_friends_ids_/likes?access_token=_valid_acess_token_ This will give you info like:

     "data": [ { "name": "Swing Facil, en espa\ñol", "category": "Website", "id": "277416935626207", "created_time": "2011-10-21T11:14:06+0000" }, { "name": "Frontier Ville Friend Finder", "category": "Games/toys", "id": "127903637247191", "created_time": "2010-11-03T21:31:06+0000" } ] } 
  3. This way you can get all the friends likes info, now you just have to look for the 'like' name or category you want to make the filter for and keep those friend id's in an array

The filter param for the request dialog will be something like

[{name: 'Filter name', user_ids: [1, 2, 3]}, {name: 'Other filter name', user_ids: [4,5,6]}]

To enable the user to select who they wish to send a request to, you can invoke the Request Dialog as below.

function sendRequestToManyRecipients() {
  FB.ui({method: 'apprequests',
    message: 'My Great Request',
    filters: [{name: 'Filter name', user_ids: [1, 2, 3]}, {name: 'Other filter name', user_ids: [4,5,6]}],
  });
}

For more info, i recommend you to read Requests Dialog

I hope this help you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM