How do I get all photos a fan page is tagged in with the Facebook Graph API? - facebook-graph-api

I was able to write a PHP application which requests an access node for the admin of the FB Fan Page, and then requests an access node to gain access to the fan page itself.
I'm now able to get all photos that were posted to the timeline of the fan page by going to https://graph.facebook.com/GROUP_ID/tagged?access_token=...
However, I actually want the photos the fan page is tagged in. The above url only gives me the photos posted to the time line of the fan page, not the ones in which the page is tagged by other users. According to the developers documentation I could get these by going to https://graph.facebook.com/GROUP_ID/photos?access_token=...
Everything seemed to work this way. I got a photo in which the fan page was tagged (profile picture of the fan page). However, I don't get any other photos in which the fan page is tagged. I tried to tag the fan page in its own photos (posted and tagged by an admin of the fan page) and tagging the fan page in other people's photos, but I only get the one profile photo in which the fan page is tagged.
Is this a permission problem or something else?
When requesting the access tokens I asked for the following permissions:
offline_access
read_stream
manage_pages
Any help would be greatly appreciated.

Related

Facebook Graph Not Getting All Photo Posts

I'm trying to get all posts from a facebook page for the last two years. Access token is my own which has manage_pages, publish_pages, show_page_list.
The posts are there, they're moderately old early 2016, but, graph doesn't bring them back these older ones. They were scheduled posts, visibility=everyone and of 'photo' type. Any query on {page}\feed, {page}\photos, or {page}\posts yields only a couple of posts.
Facebook Insights Screenshot
https://pasteboard.co/Hde6ZWU.png
Graph Explorer Output Screenshot
https://pasteboard.co/Hde7iDP.png
Does anyone know how to enumerate these posts with graph, or know of the reason why graph isn't reporting them using the get/feed and get/photos command?
These aren’t photos, they are posts.
1409847682673697/posts?since=2016-01-01&until=2016-02-01
shows the first post from your dashboard screenshot, “Andrew Smith - Malta”, just fine.
This is a share of a post onto your page only - the “original” is https://www.facebook.com/andrewmsmithart/photos/a.1533059820295875.1073741827.1533035286964995/1648921165376406/ But since that is not a photo uploaded by your page nor has your page tagged in it, naturally it doesn’t show when you request your page’s photos.
The object_id field of your page post refers the actual photo object.

Facebook different users posting to different pages as the page itself

I have a facebook application and want to use it to allow my users to post simple messages on a page.
I used api explorer and made a few api calls to post but all that I post is not visible for other users than the one I am logged with and for not-logged-in users. I want my api-made posts to be visible for everyone, not just for the user that posted them.
I mention that if I make a post using the textbox directly (manually) on the page then those posts are visible to everyone, even for non-logged-in.
Is there a step-by-step tutorial for this?
What I finally want is to allow users of my site to post messages to facebook directly (after login to facebook of course). Posts should be done by different users to different pages as the respective page.
Code samples are much appreciated.
For posting to a page as the page, get a page access token: https://developers.facebook.com/docs/facebook-login/access-tokens/
To post as the page, you need an access token with manage_pages permission. And there’s no build-in way for a page admin to get notified when someone wants to post to their page as the page, because that’s not a common use case. But the page admin can grant you manage_pages once so you get a page access token, and then you can use that in your app to post to the page, you just have to set that access token explicitly when doing so.

photo not in any album facebook

i've noticed that there are some photos that doesn't appear in any albums. This photos are published by fan on a facebook page.
Is there any way to get this photos by the API ?
The API call /feed returns all the posts of the wall, but many of this photo that i seen in the wall on browser doesn't appear in the response of the API.
Any idea ?
Try using below
https://graph.facebook.com/<YOUR_PAGE_NAME>/picture
Hope this help
Kaushik
I use
graph.facebook.com/PAGEID/photos
Permissions Needed: user_photo_video_tags or friends_photo_video_tags.
refer to: http://developers.facebook.com/docs/reference/api/user/ user photos
http://developers.facebook.com/tools/explorer/?method=GET&path=me%2Fphotos
I have a live example of this usage is you wish to test. it is an iframe plugin that feeds the photos for a page. "is not set up for users".
Just replace "anotherfeed" page user name with any page.
https://anotherfeed.com/api.beta.php?type=photos&pageid=anotherfeed&width=350&height=500&limit=20&offset=0

Uploading photos to a Fan Page Album

I'm creating an Application to upload photos to an album on a Fan Page.
This all seams to work as long as I'm the administrator for that Fan Page using the "manage_pages" permissions... but whenever I try to upload it as a "regular" user it fails because the user doesn't have the administrator rights (which of course makes perfectly sense).
I just can't seem to find a solution to solve my problem and to allow people to upload photos to the Fan Page's Album without becoming an fan-page administrator.
I really hope someone can help me since I've been struggling a few days trying to get this to work.
Cheers, Dwight
Non-Admins are not allowed to post to a fan page's album. They can post a picture to the page's feed. The page's feed album is different than the admin album. I tested this out last week for a similar question asked on S/O.

How can I allow my users, who create pages on my website, to communicate back to those people who click the Facebook "Like" button on their pages?

OK, apologies for the verbose title. Let me give the background in a bit more detail.
My website allows my registered users to create new pages, each of which has its own unique URL. Each page has a Facebook "Like" button on it. I've already implemented Facebook Open Graph API meta tags so that the pages are proper open graph objects, and when some other visiting Facebook user "likes" the registered user's page, a post appears on that Facebook user's wall saying they have liked the page. The Facebook Like widget also displays the number of "likes" that page has received as normal. So far, so good.
What I want to do is allow my registered users to be able to communicate back to the Facebook users who have liked their page. The community of "likers" for a page is a potentially valuable social media resource to the registered user, if only they could communicate back.
I am aware of the "admin page" link you get beside the Like button, which can be used to post to these people, but that is not an option for my registered users as they have no privileges in relation to the Like button.
What I want to do, if possible, is setup a form to capture the registered user's message back to the Facebook users, and then my website sends the message on their behalf, without having to ask for any extra privileges from the Facebook users.
The following Facebook documentation pages seem to say this is possible, but having followed the Open Graph API documentation, I can't get it to work as described - http://developers.facebook.com/blog/post/465/ and http://developers.facebook.com/docs/reference/api/ ("Publishing" subsection). I can get the access token correctly in the first request, and plug that into the second request to do the post, but that doesn't seem to do anything and doesn't return any error.
Since it doesn't work for me, I'm wondering if this is possible as described, or do I need to get some sort of extra permission to do this? I've seen reference to offline_access permission but as I'm new to this stuff I am not sure how it would fit in. If I have to get the Facebook users to grant permissions, this is not going to work as envisaged.
Any thoughts would be most helpful.
The short answer: No, You will never been able to post on someones wall as another user.
The long answer:
You could try to ask for offline access but then you are asking the user to hand over all their facebook data and give you access todo whatever you like their accound, so that is not likely to happend.
The next problem is that they have to be friends to be able to post on each others walls.
Thats why Pages was implemented, so that organisations could announce/talk with the people interested.
However if you have created the like button correctly and give the pages correct meta data, you are able to post to user who have liked it.
Scroll down to Publishing:
http://developers.facebook.com/docs/opengraph/
Just add a form for your user and let your system publish to the correct page, you probably will need a offline token from your own account or similar to use on the server.
Another more complex way could be to generate a facebook page for each page you have on your server.
When the user creates a page on your system a page is created on facebook but as your app as admin.
And when another user likes the page they like the facebook page, hence you have the possibility to post in that page and speak to the user who liked it. (whooa thats a mouthfull).