My problem is: When I post to page's wall some message with link it shows as Posted By Others, without link it shows normally in page timeline (Im group's admin ).
The same code posts to my timeline just fine:
I use AS3 library.
My permissions:
"publish_stream", "user_photos","publish_actions","manage_pages"
my post code:
var params:Object = new Object();
params.message = messageTextInput.text;
params.description = "description";
params.caption = "caption";
params.name = "name";
params.link = "http://www.ya.ru";
params.picture = "http://image.bayimg.com/cajchaado.jpg";
FacebookDesktop.api(page.id+"/feed", onCallApi, params, "POST"); //use POST to send data (as per Facebook documentation)
Facebook documentation says I can post either link or message, but it works just fine, except of showing in "Recent posts by others" ( please see attached screenshot ).
To post on a fanpage on behalf of itself (not the user), you have to use the page access token.
What happening is- when you make the call, the sdk uses the default token (user token), so the post is published on behalf of the user which is displayed in the "Recent Post by Others" section in the page.
Since you have requested for manage_pages already in your code, you can simply obtain the page access token with this call- /{page-id}?fields=access_token. Use this token with your current call just by adding the parameter access_token-
....
params.picture = "http://image.bayimg.com/cajchaado.jpg";
params.access_token = "{page-access-token}";
....
Related
I created a Facebook app that I will use to programatically post information to Facebook. I've got it working so that I can post to my wall, but not the page I'd like it to go to (for which I am 1 of 2 administrators).
this posts to my page just fine:
FacebookClient facebookClient = new DefaultFacebookClient("<ACCESS_TOKEN>");
FacebookType publishMessageResponse = facebookClient.publish("<MY_FB_NAME>/feed", FacebookType.class, Parameter.with("message", "Testing..."));
but if I try to post the page, I get an error:
com.restfb.exception.FacebookOAuthException: Received Facebook error response of type OAuthException: (#200) The user hasn't authorized the application to perform this action
The code is the same, except I replace my name with the page's ID:
FacebookClient facebookClient = new DefaultFacebookClient("<ACCESS_TOKEN>");
FacebookType publishMessageResponse = facebookClient.publish("<THE_PAGE_ID>/feed", FacebookType.class, Parameter.with("message", "Testing..."));
The app is listed as one of the apps for the page.
Thanks for any help with this,
Frank
Are you sure you have the correct (publish_stream) Permission?
You'll need that to post as the user to places other than their own profile.
As FaceBook launched a new concept of pages, I created a page, but I am not able to find any C# SDK for posting on that page's timeline from code.
First you need C# SDK
you can download from here
http://csharpsdk.org/
may be you need manage_page permission to get a page access token
you can get a page access token using this Graph Request http://developers.facebook.com/tools/explorer/?method=GET&path=me%2Faccounts
after getting page access token you can post a on page wall using this code
var fb = new Facebook.FacebookClient(PageAccessToken);
var postArgs = new Dictionary<string, string>();
postArgs["link"] = "http://www.foo.com";
postArgs["name"] = "Click Here To View";
postArgs["message"] = Message;
fb.Post("[pageid]/feed/", postArgs);
I'm making a simple Facebook app that posts updates to the user's timeline using node.js and Facebook's Open Graph API. Even though I can see the posts I make using the OG API on my timeline (and it has the globe icon identifying that it's a public post, see pic below), none in my FB friend network can see it.
Here's a screenie of a public post I made via OG API showing up on my timeline, along with a post from a 3rd party app (Pool practice) for comparison:
Now here's the screenie of my friend's timeline showing only the Pool Practice post, the post from my app is nowhere to be seen...
I've checked the app settings and permissions as well as the OG API options, but haven't seen anything that points to how I can solve this problem. Here's the node.js code I'm using to post the updates:
// app permissions set to 'publish_actions' and 'publish_stream'
// I do the auth dance here to get the access_token and store it in session as fb_token
var request = require( 'superagent' ); // module from TJ Holowaychuk similar to "request"
request
.post( 'https://graph.facebook.com/me/feed?access_token=' + req.session.fb_token )
.send( { message: 'posting via node.js' } )
.set( 'Content-Type', 'application/x-www-form-urlencoded' )
.end( function( response ) {
log( response );
});
The code above works and the post shows up on my timeline, but no one else is able to see it.
Anyone know a way out of this?
you need to submit each action for Facebook validation before your friends can view it. Only users defined as developpers for the app are allowed to view those timeline messages.
I'm trying to post directly to an application's wall without linking it to my account. I keep getting a "(OAuthException) (#200) The user has not granted the application the permission to automatically publish feed stories". This is from a winform application.
var oAuthClient = new FacebookOAuthClient();
oAuthClient.AppId = "APP_ID";
oAuthClient.AppSecret = "APP_SECRET";
dynamic token = oAuthClient.GetApplicationAccessToken();
var appToken = token.access_token;
FacebookClient fbClient = new FacebookClient(appToken.ToString());
var args = new Dictionary<string, object>();
args["message"] = "Testing 123456789 from C#";
fbClient.Post("/APP_ID/feed", args);
Citing from facebook docs for stream.publish:
Posting to Your Application's Profile Page
In order to use stream.publish to post on the Wall of your application profile page (your application's About Page), all the following conditions must be true:
The posting user needs to grant the application the publish_stream extended permission.
The posting user must like the application's profile page.
A developer of the application must edit the application profile page's Wall Settings (Edit Application > Edit) and verify under Posting Ability that Fans can write or post content on the wall is checked.
From this it is obvious you cannot post to application wall with application token, only with token of user that likes the app.
In the Facebook UI, you can hit "#" when you update your status and get a list of pages where your status update will be added as a Related Post on the page.
Is there a way to do the same in the Graph API? Assuming all authenticated, calling me/feed with a "message" parameter like this (using .NET Facebook SDK):
var client = new FacebookClient(ACCESS_TOKEN);
var parms = new Dictionary<string, object>();
parms.Add("message", "TEST fb SDK: #whatever");
client.Post("me/feed", parms);
The status update is posted, but the page doesn't doesn't get resolved as a Related Post.
If you GET a feed entry which has a Related Post created from the UI it's shown as a status update with the "to" parameter populated with the page. If you recreate that message as a POST in the API, the Related Post gets created, but:
the Related Post shows on the Info tab of the page, not the Related Posts tab
the status update doesn't have a link to the Related Post
Any thoughts? Thanks!
Someone has posted an undocumented way of tagging users using Facebook Graph API that involves using a #[{user_id}:1:{name}] syntax, eg: #[{4}:1:{Mark Zuckerberg}]. There is an open request with Facebook for full documented support of this method.