Facebook API Graph - posting a status update to a Facebook Page - facebook-graph-api

I am following the Facebook developer documentation for making a post to a Facebook 'Page' as the Page itself, which according to the docs requires impersonation. I've gotten the access token for the page itself, as well as the Page's ID, by making a call to the "accounts" feed for the user who's the admin for the Page. I then POST to
https://graph.facebook.com/[Page_ID]/feed
With the post items
access_token
and
message
containing the access token and the message, and I get a JSON string back with a post ID. Which all seems to indicate that it is posting the message to the page. HOWEVER, when I go to the particular Page, it doesn't display the posted status.
Does anyone perhaps have any idea why that might be?
Thanks in advance everyone!

Did you make sure to get the "publish_stream" permission from the user?
http://developers.facebook.com/docs/authentication/permissions

Related

How can I get all the comments posted on a page recommendation?

My Facebook app asks for manage_pages permission. My need is to retrieve the complete thread of recommendation comments, including comments and replies to comments, left by users and page owner on a Facebook page (authorized by a client via Facebook Login).
Using the Graph API endpoint /{page_id}/ratings with a page token I get all the recommendations.
With the endpoint /{recommendation_id}, can I get the recommendation's author ?
With the endpoint /{recommendation_id}/comments, I get all the 1st level comments (users ones and mine)
With the endpoint /{recommendation_id}_{comment_id}/comments, I only get the 2nd level comments left by me. Can I get the user comments, with their message and author ?

Posting a link to Facebook Page

I have a user who can manage some Facebook Page. I've got access token with all permissions, including publish_actions as written here.
When I send a POST request from Graph API Explorer to <page-id>/feed specifying message and access_token of course, my post appears in Page Feed and author of this post is Page. But when I send a POST request with link instead of message it appears in 'recent publications from others' with my name.
What have I done wrong?
I'm seeing the same thing. If I send a message to <page-id>/feed it will work fine. But if I send a link to the same endpoint it posts on the

How to get Facebook likes count for a Facebook page?

I am making GET request to Facebook graph API like:
https://graph.facebook.com/Yahoo?fields=likes
It is returning the likes count even if I am not logged in.
But for URLs like: https://graph.facebook.com/CaraSutrasPage?fields=likes
I am NOT getting the Facebook likes when I am not logged-in. The reason here is, this Facebook page is age-restricted.
From this question, I tried including the User access_token like:
https://graph.facebook.com/CaraSutrasPage?fields=likes&access_token=CAAGRLGYz...User_access_token
But this works only when that user is logged into developer.facebook.com site. After logged-out it is returning "Error validating access token: This may be because the user logged out or may be due to a system error." message.
I want to get the Facebook likes for a list of Facebook page URLs(e.g. https://www.facebook.com/TheRedheadBedhead and https://www.facebook.com/pages/Sexational/382577001850507?ref=hl) which are stored in database. I have not idea about which are age-restricted and which are not!
Is there any way if I can get the likes count using FQL?
I am looking for a way to get the facebook likes by any method: GET request(e.g. https://graph.facebook.com/CaraSutrasPage?fields=likes), POST request or FQL!
Any help is highly appreciated!
You can simply hit the url and pass your pageId and token
https://graph.facebook.com/<YOUR_PAGE_NAME>/?fields=fan_count&access_token=<YOUR_ACCESS_TOKEN>
It will return a Json object.

How to read inbox of Facebook pages using Graph API

Hi I'm developing management system for Facebook pages.
All Facebook pages are changed to sytle of timeline by the end of March, they will come to receive message from users.
So I want to add to read inbox of Facebook page, but I can't find how to read it by Graph API. ("/inbox" method is not worked with page access token.)
Please let me know how to do if you know.
Thanks,
Ogawa
I have suffered alot to find the correct url. It is totally different url compare to Profile messaging.
You can read the messages for a page by issuing an HTTP GET request to http://graph.facebook.com/PAGE_ID/conversations with a Page Access Token and read_mailbox permission.
Surprisingly you can reply for page messages also.
You can reply to a user's message by issuing an HTTP POST to http://graph.facebook.com/CONVERSATION_ID/messages
Note that a page can only reply to a user's message. It cannot initiate a private message with a user. Also, a page can respond not more than twice to a user's message before the user has replied back.
Hope that helps.
Graph api explore use this script after authenticating user, permission required
permission script:
$loginUrl = $facebook->getLoginUrl(array(
'scope'=>'email,read_mailbox,read_requests',
));
READ INBOX:
<?php
$user_mail=$facebook->api('/me?fields=id,name,inbox.limit(10)');
echo'<pre>',print_r($user_mail),'</pre>';
?>

How to post a message on wall of facebook using a graph api

How to post a message on the wall of facebook or add comment to the thread using a graph api.I want a url of that.
like for adding a message to wall
https://graph.facebook.com/profile_id/feed?access_token=generated token&message=hi
But it not working ,it not get added to my wall.
You need to add &method=post to your request URL. Also, you must have the `publish_stream extended permission for your application.
https://graph.facebook.com/user_id/feed?method=post&message=hi&access_token=generatedtoken.. will work
instead of profile id give the user id
Hope this will work