Facebook sdk Unity open graph action does not display - facebook

So, I am trying to implement the facebook open graph posts in our game for highscores, but it doesn't seem to post anything. When I do this:
Dictionary<string, string> data = new Dictionary<string,string>() { {"highscore", "http://samples.ogp.me/111111111111111"}};
FB.API("me/namespace:get_a_new", Facebook.HttpMethod.POST, HandleOpenGraphCallback, data);
When I log the FBResult.text in the HandleOpenGraphCallback callback, I get a valid json response looking like this: {"id":"422166374597399"}. But the problem is that I see nothing on the test account that sent that request. The request obviously kind of worked since I receive an id in my callback function, but I see no post. Do I need to put more information in my dictionary in order to even see the post in the my test account timeline? I also put the "publish_action" permission in my login to be sure.
Thank you.

Related

AS3: Post to Facebook Wall - Error #2032

I am currently developing an app with which visitors of an event can take pictures using a webcam and upload them to Facebook using an AS3-application. I know I can connect to Facebook, because I can log the user out using the API and I can get all the information. The problem is that I can't post to their wall for some reason. I keep getting the following error:
error #2032: stream error. url: https://graph.facebook.com/********/feed
I use the following code to post to Facebook:
private function postFB(e:Event=null):void {
var _params:Object = new Object();
_params.uid = Facebook.getAuthResponse().uid;
_params.access_token = Facebook.getAuthResponse().accessToken;
_params.message = "I was at the Thanksgiving Day Event.";
//_params.picture = _bitmap;
Facebook.api("/me/feed", postComplete, _params, "POST");
}
As I've said before, I know I am connected to facebook because if I change "POST" to "GET" in my api-call, I get all the information of my account. I have the correct permissions as far as I know (read_stream, publish_stream, user_photos). I use GraphAPI_Web_1_8_1.swc as an api.
The documentation on the entire api is very poor, so I am trying to figure out the problem. It's been a few years since I've tried any of this, so my code has probably aged too far by now. So, any ideas what I'm doing wrong?
publish_stream is deprecated (since years?), you need to use publish_actions.
If that does not work, make sure the Access Token includes all the permissions, you can test this in the Debugger: https://developers.facebook.com/tools/debug/
Side note: AS3 is not getting used very often anymore, the last version of the the AS3 SDK is from 2011. It may be a good idea to switch to the JavaScript SDK.

400 Bad Request when implementing custom friend selector

I'm trying to implement a custom multiple friend selector to invite users to my game. I get the list of users calling the Graph API call InvitableFriends, and create a UI for it.
After the user selects the corresponding users, I get all the invitation tokens of the users, and make a call to an App Request as follows:
public void InviteFriends(string message, string title, FacebookDelegate callback, string[] to = null, string data = "")
{
if (FB.IsLoggedIn)
{
FB.AppRequest (message,
to,
"",
null,
null,
data,
title,
callback);
}
}
But when the call is made, I'm getting the following error:
400 Bad Request
UnityEngine.Debug:LogError(Object)
FbDebug:Error(String)
Facebook.FallbackData:JSFallback(String)
Facebook.AsyncRequestDialogPost:CallbackWithErrorHandling(FBResult)
Facebook.<Start>c__Iterator0:MoveNext()
My callback function is never called, so I can't see what the error is.
I'm using Unity 4.3 & Facebook SDK 5.1
Thanks for your help!
EDIT: I'm pretty confident that the issue is that in the TO parameter I'm passing the invite tokens that the Invitable Graph call is giving me, AND NOT THE Ids.
I tested the InteractiveConsole.cs example of friendsmash with the invitable token and it also failed. How can I get the ids of the invitable friends?
just check the url request. It may be some thing wrong with it.
or
go to https://developers.facebook.com/apps/{app-id}/app-details/
in "app Info" section, choose the proper category and sub category.
I had a similar issue.. Figured out that FB.init() has to be called before using the invitable api. Without it you would get a "400 Bad Request"
I was keeping the old access token in playerprefs and just checking it again for validity and not actually initialising FB to save load time. But eventually I had to do FB.init()

How to hide a Facebook post from timeline?

I'm desperate to hide a Facebook post (mine or a friend's post) on my own Timeline but it doesn't work, I don't even know if it is possible !
What I've done is :
First, I checked on my timeline on the specific post if it can be hidden or not
I implemented this code :
facebookClient.publish(String.format("%s", postKey), Post.class, Parameter.with("is_hidden", "true"));
I have actually a response like :
missing parameter reorder_pids[]
If I specify it, it asks me for a valid merge photo id etc. But I'm not sure if I am in the wrong direction. One of my colleague told me that it works for him but impossible to determine what is the difference.
I tried this function on a normal account and also a Facebook page.
Here it is:
String _mode = "hidden"; // or "normal" or "starred"
facebookClient.publish(_post, FacebookType.class, Parameter.with("timeline_visibility", _mode));
As soon as Post will be hidden - you won't be able to retrieve it by FQL request, even by post_id. It is almost like "delete". But you can still publish with timeline_visibility=normal.

Trying to update a Facebook event using the Graph API (Facebook C# SDK)

I am trying to update the description of a Facebook event using the Facebook C# SDK. I have granted the following permission to my application:
'publish_stream,email,manage_pages,user_events,create_event,rsvp_event'
The event I am trying to update is one of my own events, so I believe I should be able to update it.
In the code below "9999" is the event id of the event I created, and the event I am trying to amend:
Authorizer authorizer = new Authorizer();
FacebookClient fbapp = new FacebookClient(authorizer.Session.AccessToken);
Console.Write(fbapp.Get("9999"));
dynamic parameters = new ExpandoObject();
parameters.description = "the new description";
fbapp.Post("9999", parameters);
The fbapp.Get works fine and returns the details of the event.
The problem is with the Post method, this returns (OAuthException) (#200) Permissions error
Any ideas as to where I am going wrong?
This issue is in fact a bug in the Facebook Graph API, see here for the bug report
It appears to be the case that you can only use the Graph API to edit events created by your app, and not existing events created by users within Facebook.
Hopefully it will be fixed soon!
If you really have all permissions, I think you should include every mandatory field in the parameters (as I haven't done this, I can only guess!) and not only the field you wish to edit.
Hope this has helped you Andrew.

Access Facebook albums from a flash app

I want to create a flash Facebook application in which, after pressing a button, the user will be able to browse his/her photo albums and choose a photo. How should i do that? What will be the code under the button to gain authentication from any user using this application?
Thanks.
I am currently writing a facebook application for a university assignment that will allow the user to do everything you can do in facebook, but via the flash player window. You will need a few basic things happening in order to do it.
User log in and authentication - this must be done via Facebook - using OAuth authentication, and meeting all of facebook's security policies
register the application with facebook
Use the Graph API (facebook's developer's toolkit) to get the necessary functions that will communicate with facebook via flash.
In Flash itself you will use a bunch of URLRequest functions to send out to FB for information, then you will need to retrieve that data responses and store them to variables (extracting data with a few lines of code is easy, something like this;
//initialise variables
public var photoURL:String;
var Request:URLRequest = new URLRequest("http://www.whatever the url for the graph api service you are using which is founf from FB");
//that ^^ will send off a request for the url, you then want to use the returned data by registering an event handler like this below
functionName.addEventListener(onComplete, completeHandler);
functionName(event, EVENT)
{
var loader:URLLoader = new URLLoader(Request);
var data:XML = new XMLData(load.loader); //i think this is right but not 100% sure, fiddle with it
//then you want to extract the data that is returned, for example, extracting xml data from a rest request works by hitting data from the xml by specifying a path to the object you want. an example of xml is this <rsp stat="ok"><photos ......more code="morecode"><photo url="url of photo"></photo</photos> so you can hit the url in that example like this;
photoURL = data.photos.photo.#url; //this line will grab the photo url for you, allowing you to dynamically create an array and assign photos to the flash stage according to the url you get
}
this is fairly advanced stuff and I am assuming that you have some decent knowledge on AS3, XML, and the FB API, if you need more help just reply