Like all new posts on a particular page on Facebook - facebook

I am managing an organisation's page on Facebook and want to like all posts made by the page from my personal account.(Let us say the posts from now on and not from the time the page was created) I have no idea how to proceed as I haven't explored facebook's developers tool. Can someone help a bit?

Well, its a very broad question. I dont know what language are you using and are you aware of graph api or not. So first of all go through the basics-
Using the Graph API
Access token - all API calls must be signed with an access token
Login - very important part i nfacebook integration, yet I think its not relevant to this question
Graph API Explorer- a tool provided by facebook to test the API calls. (first register on the developers site if you have not yet)
Now coming to the solution to the question-
First of all you'll be needing the post IDs of the page. To query for all the posts-
\GET https://graph.facebook.com/<Page-ID>/posts?fields=id
Example to fetch all the public posts by "Aam Aadmi Party".
Then, for each of that post id, you have to make a POST call to /likes, this will return true on success and the post will be liked.
\POST https://graph.facebook.com/<Post-ID>/likes
Example to like a post from the "Aam Aadmi Party" page.
Hope it helps. Good luck!

Related

Facebook Graph API insights

I'm new on working with Facebook and honestly I found it very confusing, terminology and documentation seems to be very ambiguous in many cases. Can somebody please help me out with a plain english explanation on how I can achive the following?
Post and image to Facebook (on the user page) and then check the stats (insights) of that post.
Till now I have managed to:
1) Create an app
2) Post the image on the user page with the desired message
I'm not able to understand how I can retrieve information about the particular image which was uploaded through my app. I want to know how many people have viewed that image, how many likes did it get, how many times it was re-shared.
Is it possible at all?
I'm posting to /photo not too /feed and I will like to keep it this way if it is possible.
Sorry if this was answered already but I spent a few hours trying to find an appropriate answer but wasn't able to get the right documentation.
UPDATE 1
After having a couple of days off from this topic and receiving the first 2 answers, I took another dive into this. Now I have tried the Graph API Explorer as suggested, and using the ID of a POST I can get some details about the POST, but the insights aren't showing anything, just next and previous.
My goal is to be able to gatther some stats about the pictures uploaded through the app. If this is not possible directly what should be the approach I need to take?
I don't believe a personal /photo has /insights attached to it - the Insights Object documentation page suggests that they do not - but you should be able to get likes, shares, and comments via the API.
It would appear FB has launched a redesign/reorganization of its documentation in the last couple of weeks, but the documentation for the /photo graph object is here -- you will need the user's Access Token, and the API endpoints you're looking for each have links to their own documentation pages there, including example code for each type of request.
Edit (summarizing discussion in comments):
There is no method via the Facebook API to gather insights for all photos posted to individual user timelines via an app. The app can gather likes, shares, and comments for each of those objects individually via API requests, and can make API requests for insights for photos posted to its own timeline. Neither of those options solves the intended use case here.
I'd recommend a solution that uses Sharing rather than an app integration, as this allows for better access to insights on the photos being shared. This is also a much simpler integration, and less brittle wrt future Platform changes. The main tradeoff is that the original photos being shared are expected to expire after a couple of months -- if this is unavoidable, I'd suggest implementing a redirect for requests for expired objects on the site.
We are able to get different kind of photos or picture Using Graph API
like as below:
1.Page Photos
Photos for a Facebook Page.A Page Access Token is required for all methods.Find here
2.Page Picture
Picture belonging to a Facebook Page. Find here
3.Photo
Represents an individual photo on Facebook. Find here
4.User Photos
Photos for a person.Find here
I hope it's helps you.

Tag persons in Facebook page post

I've written a Facebook web application, which is able to post links to the app page feed (as the page) by requesting the page token and doing a post request to the /PAGE_ID Graph REST endpoint. So far, so good, but I'd like to tag the links with their authors as well. When I add the tags parameter to this request with a value of my user id (I am an admin of the page), this works fine. But when I enter another user id (even one that likes the app page), no tagging is done. Does anyone have any experience with this? Some blog post suggest this is not possible using the Graph API, even though this is possible when done manually.
Thanks!
If I understand correctly what you want to do, it is no longer possible with the new version of the Facebook's API (v.2.0).
Refer to this page for more informations.

Get list of IDs of Facebook post likers, commenters and sharers?

How can I get the actual Facebook IDs of all people who liked, commented (+replied to comments or liked comments) or shared a post (e.g. a post by a person or a FB page).
Looking for a programmatic solution in PHP.
(I am not familiar with programming for Facebook and their API)
I would advise you to try to dive in a topic yourself before asking help. These kind of questions are all over internet and are easy to find.
That said; you can use the /sharedposts edge on Graph Objects. Starting from there, you can dive into the documentation of the Graph API.
edit: To be more explicit, you can't just get all of the people. You have to use the /sharedposts endpoint to get the posts. You will only receive the posts that are accessible to your app; e.g. specific user (privacy) settings are taken into account.
If you have the ID of a post, say 1234_5678, you can get these by calling:
https://graph.facebook.com/1234_5678/sharedposts?access_token=[access_token]
If you are unfamiliar with the Facebook Graph API, asking for just the code won't help; it's not a single call and you would need to implement authentication / app access token. So that's why you need to dive in yourself; the documentation is pretty good resource to get started.

Sharing links posted to a wall via an app

I've created an app which enables business to post links to their Facebook wall as the business (have proper business auth tokens, etc.).
However the links posted via the app do not have a share link, only comments and like. When a link is posted through the Facebook UI to the business wall it does contain a share link along with comments and like.
What am I missing to enable the link posted via my app to have a share link?
I am currently issuing a POST request to the following URL to create the posts:
https://graph.facebook.com/[profileId]/feed?message=[message]&link=[link]&...
this is a reported bug and have not been fixed yet. have a look (http://developers.facebook.com/bugs/307556529334653)
I think you will need publish_stream permission for that and publish what they write. IMO Facebooks makes difference between feed and stream. Just my thoughts :)
that's the standard procedure when you have a user post via app. I don't think there's a way to have users post as themselves, as far as links are concerned. What you can do is have them post a status update and that one will be seen as posted by the user (no app information).
There's no other procedure I am aware of that can do that. I hope this helps

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/