ios - How to discover which friends accepted invites with Facebook API? -
facebook api v2.0 introduced invitable_friends
edge.
an example response request edge is:
{ "data": [ { "id": "avkgk9flfxasdvxnbdv_gyogr6lxa9sklnh...", "name": "anita sujarit", "picture": { "data": { "is_silhouette": false, "url": "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-prn2/t1.0-1/c0.0.50.50/p50x50/1470158_10201991701127909_302023572_t.jpg" } } } }
looking closely @ id, it's not normal facebook user id. instead it's invite token; token passed requests dialog value to
parameter.
the invite token, returned on each of friend objects value of field named id, unique (per user , per game) string of variable length. invite token subject expiration, , may change between game sessions. therefore not advisable cache these results, or try assign them given person.
the friends
edge returns friends already using app
my problem have no way cross-reference friends have invited , have accepted.
previously, have stored friends id sent them invite, and, @ later point, checked against list of friends playing game, isn't possible several reasons:
- the invite token isn't present on friends edge
- and it's dynamic anyway
- the normal user id isn't present on invitable_friends edge.
- i use user's name key, isn't unique.
actual question: has devised way of determining, users have been invited, have accepted invite please?
tldr: save response actual invite these friends request
as far understood reference provided:
you can start requesting invite_token
s assume able do.
as answer per invitable_friend
:
{ "id": "avlzytkxshfbqle58zr9ty5dz7l0wlttukwkt0z5v87zkwv-39...", // invite token "name": "guy cross", "picture": { "data": { "is_silhouette": false, "url": "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-prn1/t5.0-1/623782_622770420_2109148508_q.jpg" } } }
the page mentions earlier how requests in general:
fb.ui({method: 'apprequests', message: 'your_message_here', to: 'user_id, user_id, invite_token' // says invite token }, function(response){ console.log(response); });
look @ line to
: can put invite tokens in there.
now response looks this:
{ request: 'request_object_id' to:[array of user_ids] }
there got user ids.
if go further , either need more informations or want see accepted, have 2 options:
- you can check if user id has authorized game
- when new user logs in, can ask requests new user. there can track invited him.
get https://graph.facebook.com/me/apprequests?access_token=[user access token]
- you save data (stated in tldr) , check everytime new user joins game, if new user id in list of requests mentioned.
to check invited him, can check request_object_id
http://graph.facebook.com/{request_object_id}?access_token=user_access_token
of recieving user , following response be:
{ "id": "request_object_id", "application": { "name": "app_display_name", "namespace": "app_namespace", "id": "app_id" }, "to": { "name": "recipient_full_name", "id": "recipient_user_id" }, "from": { "name": "sender_full_name", "id": "sender_user_id" }, "message": "attached_message", "created_time": "2014-01-17t16:39:00+0000" }
if go user access token sender this:
{ "id": "request_object_id", "application": { "name": "app_display_name", "namespace": "app_namespace", "id": "app_id" }, "from": { "name": "sender_full_name", "id": "sender_user_id" }, "message": "attached_message", "created_time": "2014-01-17t16:39:00+0000" }
to prevent this, can specify user id of recieving user , same answer receiver: https://graph.facebook.com/{request_object_id}_{user_id}?access_token={app_access_token}
Comments
Post a Comment