How to like a post or a page via Facebook API - facebook

I'm searching the solution to like a post or a page via Facebook API with a USER_ACCESS_TOKEN
The doc facebook here https://developers.facebook.com/docs/graph-api/reference/v2.8/object/likes#publish said: Note: as of Nov 17, 2016 we changed the behavior of publishing likes and only support this action with Page Access Tokens. But I want to publish like as user but not page
Then I found another doc facebook here https://developers.facebook.com/docs/opengraph/guides/og.likes#publishing
but I got an error {"error":{"message":"Unsupported post request. Object with ID 'PAGE/POST_ID' does not exist, cannot be loaded due to missing permissions, or does not support this operation.
Anyone can help, please? Thanks!

Related

How to get Facebook Post Like, Comment and Share action from user

I stumbled into a facebook post where when user click the like button, or share the post or post a comment, a facebook page bot will automatically message the user. Here is the exact post:
https://www.facebook.com/ninjateam.org/posts/1799394500352455
I'm trying to look into the facebook developers API documentation on how to do those kind of functionality but always failed. Can you point me to the correct path where to start or what resource is used in those kind or post?

Unable to get page feeds that are shared from a facebook profile

Ok I get some restriction from facebook which I am unable to find in developer docs.
When I request data from facebook using
https://graph.facebook.com/{user-id}/feed?limit=1&locale=en_GB&access_token={access-token}&fields=id,from,message,link,actions,status_type
Everything works ok for profile. Though for a page it provides feeds, that page has created and shared from other pages, but it never returns feeds which are shared from a facebook profile.
I tried sending some other parameter in fields, but nothing works for me. Any suggestions?
ok, I think I get the answer. And it is impossible as it is a restriction from facebook API since API 2.0
I get some answers from facebook team on this. Below is the link to it:
https://developers.facebook.com/bugs/1057965060965057

Unable to resolve FaceBook Fan Page RSS June 2015

I was pulling RSS feed from a few Fan Pages and posting to our sites. suddenly Facebook seems to have blocked or shut off RSS feeds. I am not finding a good solution or method to pull these posts from a few facebook pages ... Anyone have any suggestions?
A little more detail I was using IFTT.com to pull the rss feed and then put it were I wanted it. So the trigger was:
https://www.facebook.com/feeds/page.php?format=rss20&id=(page id)
Suddenly all of these return the following error
Not a valid feed url, missing feed title
Any suggestions code gurus?
The RSS feed is gone, the only way to get the Page feed is the feed endpoint: https://developers.facebook.com/docs/graph-api/reference/page/feed
You will need an App for this though, because you need to use a Token for the endpoint. An App Access Token is good enough though, so the API endpoint would look like this:
https://graph.facebook.com/[page-id]/feed?access_token=APPID|APPSECRET
More information about Access Tokens and how to generate them:
https://developers.facebook.com/docs/facebook-login/access-tokens
http://www.devils-heaven.com/facebook-access-tokens/

Post status update to Page Wall

I'am really new to all this Facebook development, and I wanted to integrate Facebook within my personal website.
I am now trying to test if what I want is possible.
I want to post a status from my server, via php/js to my Page in Facebook.
How can I do so?
B.W.
I saw that there is this FBJS function called "Facebook.streamPublish"
But I don't know how to integrate it.
Is there any possible way to do so?
Can you give me an example?
-Secondly, what is an access token?
You get an access_token after facebook authenticates you. You will need this access_token for all subsequent API calls. You can find the details here:
http://developers.facebook.com/docs/authentication/
You can use graph API for publishing on the wall and doing other allowed actions. Details of publishing api can be found here:
http://developers.facebook.com/docs/reference/api/post/
But do have a look on the facebook policy, because publishing automatically to a wall is considered violation.
http://developers.facebook.com/policy/

How do I post a link to the feed of a page via the Facebook Graph API *as* the page?

I'm working on a plugin for a Wordpress blog that posts a link to every article published to a Facebook Page associated with the blog.
I'm using the Graph API and I have authenticated myself, for the time being, via OAuth.
I can successfully post a message to the page using curl via a POST request to https://graph.facebook.com/mypageid/feed with e.g. message = "This is a test" and it published the message.
The problem is that the message is "from" my user account. I'm an admin on this test page, and when I go to Facebook and post an update from the web, the link comes "from" my page. That's how I'd like this to be set up, because it looks silly if all the shared links are coming from a user account.
Is there a way to authenticate myself as a page? Or is there an alternate way to POST to a page feed that doesn't end up being interpreted as a comment from a user?
Thanks for any thoughts or suggestions.
To post as the Page, you need to get an access token for the page by getting an access token for an admin of the Page with the "manage_pages" and "publish_stream" permissions. Then, using that access token, hit https://graph.facebook.com/me/accounts?access_token=THE_ACCESS_TOKEN. You'll get a JSON output of all the Pages that user admins and in there you'll see an access token for each Page. If you use one of those access tokens to POST your message, you will be doing so as the Page. The process is outlined in the documentation here (sorry, it's kind of buried).
Ah, it's a bug.
you need to use enable_profile_selector
http://developers.facebook.com/docs/reference/javascript/FB.login
Please have a look at the comments by "Nam Thai" on this thread: http://www.takwing.idv.hk/tech/fb_dev/faq/graphapi/graph_27.html. This solved the problem for me.