Invite to Facebook Game App with invite token from invitable_friends - facebook

I can fetch my invitable_friends list, and retrieve an invite token for each one:
["data": [
{
"id": "inviteTokenA",
"name": "User A"
},
{
"id": "inviteTokenB",
"name": "User B"
}..]
Then, I want to invite "User A" to my Game App. I'm trying to do it with a POST request like: "/me/apprequests", with params (message = "Some message", to = "inviteTokenA")
(If a don't send the "message" parameter, I get an error response)
I guess it's not the proper way, because I've got a success response:
{
"request": "6029343172911",
"to": [
"someID"
]
}
And someID is my Facebook ID, no matter what I send as "to" parameter.
I mean, it's an app request to myself.
And if I try to make request "/inviteTokenA/apprequests" I get:
{
"error": {
"message": "(#803) Some of the aliases you requested do not exist: AVnop7tyDDSaYC0FQYRQNIKOTIHQcmYJk2c-uSF1fLf1UUNbc0WXKt62lhLvvJZdSUrxHyYTdxFUCTkLDw6ON_I1qinF3rq6HVVfU0m7jzgj7w",
"type": "OAuthException",
"code": 803,
"fbtrace_id": "DrHiMQl8jWT"
}
}

You can not send invites via API.
The user of your app needs to send them via the Request Dialog, as described here: https://developers.facebook.com/docs/games/services/gamerequests#launchingrequestdialog
When calling that dialog, you can pass one or more of the tokens you get from the invitable_friends endpoint.

Related

PSID is unsupported GET request Graph API?

I'm trying to get labels associated with participants of conversations on my fb page.
My GET request: <pageID>/conversations?fields=participants,id&access_token=<PageAccessToken>
The POST:
{
"participants": {
"data": [
{
"name": "Jim Bean",
"email": "numbers#facebook.com",
"id": "2821512231253160"
},
{
<my page info>
]
},
"id": "<convo link>"
},
When I click on the participant's ID, I get the following error.
"message": "Unsupported get request. Object with ID '2821512231253160' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph...",
"type": "GraphMethodException",
"code": 100,
"error_subcode": 33,
"fbtrace_id": "AwlTn9Vx3mfPtRGnquaHm8k"
Thus, I cannot request labels associated with PSIDs without being able to get info on my user's PSIDs.
What am I missing? How can I retrieve PSIDs from conversations?

Is it possible to get user detailed using facebook API V2.6

I am using the "taggable_friends" api to get the list of all friends then uses the user ID (a string of 110 chars) to get user detailes like this:
FB.api('/' + gFriend.id , 'GET',{},
function(response) {
console.log("response",response)
});
In the result I get an error
(#803) Some of the aliases you requested do not exist: {The user Id I have submitted}
Did FB blocked user details API in version 2?
taggable_friends if for tagging only, you can´t use it for anything else and you don´t get a User ID. You only get a "tagging token" that can only be used for tagging. If you just want to create a "friend pic collage", you need to use /me/friends instead. Of course you will only get friends who authorized your app with the user_friends permission.
[from comments] I want to show friend pic collage
The taggable_friends endpoint does return URLs of the friend’s profile pictures already.
You get a data structure like this,
{
"data": [
{
"id": "AaKYNqeDaP…",
"name": "Foo Barski",
"picture": {
"data": {
"is_silhouette": false,
"url": "https://scontent.xx.fbcdn.net/v/t1.0-1/p50x50/…"
}
}
},
{
"id": "AaKBGEbAAvYU…",
"name": "Some One Else",
"picture": {
"data": {
"is_silhouette": false,
"url": "https://scontent.xx.fbcdn.net/v/t1.0-1/p50x50/…"
}
}
},
So all you need to do is use those URLs provided in the picture structure.

Facebook Graph API apprequests node doesn't return "from"

Moving from FQL to Graph API, I found that the V2.2 Graph API apprequests node returns inconsistent responses.
https://graph.facebook.com/v2.2/<id>/apprequests
sometimes returns JSON with the "from" field and sometimes not.
The correct JSON is:
"application": {
"name": "Myapp",
"namespace": "My NS",
"id": "123456"
},
"created_time": "2015-03-16T19:34:00+0000",
"data": "invite",
"from": {
"id": "111111",
"name": "Sender name"
},
"message": "Come and play!",
"to": {
"id": "99999",
"name": "Recipient"
},
"id": "123_456"
}
However, the "from" field in the JSON is sometimes missing (even when requesting it specifically in the "fields" parameter).
When using FQL, I always get the sender_uid field (with the same app token and same user):
SELECT request_id, app_id, recipient_uid, sender_uid FROM apprequest
WHERE app_id = <appID> and recipient_uid=<FBID>
Can anybody explain the mystery?
Facebook's response after investigating this bug: This is by design. There are certain privacy restrictions on Graph API which didn't apply to the deprecated FQL.
We investigated this on our end and found that this happens when the user blocked the application or completely removed Facebook's third party integration.

how to get facebook post after a graph search?

https://graph.facebook.com/search?access_token=xxxxxx&q=hello&type=post&fields=from,message,picture,link,name,caption,description,created_time&limit=1&locale=en_US&scope=publish_stream,offline_access,user_status,read_stream
After such a graph search, I get some data like:
{
"data": [
{
"from": {
"name": "Eric Fluegge",
"id": "100000626293694"
},
"message": "Well, here's go nothing. Hello Tennessee.",
"created_time": "2013-03-30T19:23:44+0000",
"id": "100000626293694_567340783296793"
}
],
"paging": {
"previous": "https://graph.facebook.com/search?fields=from,message,picture,link,name,caption,description,created_time&q=hello&limit=1&type=post&locale=en_US&access_token=XXXXXXXXXXXXX&since=1364671424&__previous=1",
"next": "https://graph.facebook.com/search?fields=from,message,picture,link,name,caption,description,created_time&q=hello&limit=1&type=post&locale=en_US&access_token=XXXXXXXXXXXXX&until=1364671423"
}
}
so, is "id": "100000626293694_567340783296793" a post id? If so, how to use this post id, query again, get only this certain post information? I would like to store post id to mysql table, then I want to query the post anytime in the future, thanks.
EIDT: in app setting, i have set the publish_stream,offline_access,user_status,read_stream
EIDT2:
I have tried into Graph API Explorer, choose read_stream and generate a long live token.
SELECT post_id, actor_id, message, type, attachment FROM stream WHERE post_id = "100000626293694_567340783296793"
the result still empty. so I cannot get a post bcause i am not a friend of the post auther? or 100000626293694_567340783296793 is not a post id? or other reason?
Yep, the "id": "100000626293694_567340783296793" is a post ID, you can query its data again with the following URL: http://graph.facebook.com/100000626293694_567340783296793
Attention!
You should ask for the read_stream permission/scope too! Or else you'll get the following error:
{
"error": {
"message": "Unsupported get request.",
"type": "GraphMethodException",
"code": 100
}
}
And of course, append the access_token to your GET url. (and don't forget https too)
You can check the Graph API Reference here: Post - Facebook Developer Reference

How to get the id of the user that send the request?

In my app there is a MultiFriendSelector to invite friends.
I want that the recipient see in the canvas page the id of the user that has sent the request via MultiFriendSelector.
I need to get the id without using PHP or other server side language, but I can use javascript or fbml for example.
I believe Multifriend selector is a user-user request and a typical request looks the below (from attribute will tell you the request senders information)
{
"id": "REQUEST_OBJECT_ID",
"application": {
"name": "APP_DISPLAY_NAME",
"canvas_name": "APP_NAME", // This is identical to the app namespace
"namespace": "APP_NAMESPACE",
"id": "APP_ID"
},
"from": {
"name": "SENDER_USER_NAME",
"id": "SEND_USER_ID"
},
"message": "Check out this Awesome Request!",
"created_time": "2012-01-24T00:43:22+0000",
"type": "apprequest"
}