Facebook Graph API comment from unavailable - javascript

I have a Facebook app which manages a user's page.
I am making requests using the facebook's javascript SDK, and makign a GET request at the following (with page access token of course):
pageID?fields=posts{comments{from,message}}
This returns a list of post comments and messages, as well as information about the users that posted the comments, or so I thought.
During my testing I've been making posts and comments as both the page and as myself (admin) and in both cases the from returned a value, however yesterday a friend of mine added a comment to one of the posts, and when reading his comment i can get the message, but there is no indication of the from value, it is not present.
Am I doing something wrong or is it not possible to get these? I've seen one more post on SO about this, though in that post it clearly states that if you have a token, you should be able to see this info, yet I do not.

Related

Fetch posts from Facebook page using FB API

Up until this summer, I had a website (not my website) which was fetching it's responding fb page posts and was displaying it on a page.
I was doing it using the app-token, which now doesn't work since it now requires Page Public Content Access to get those data, which in turn requires it to be registered as an app, which is beyond the scope of this.
I tried creating a non-expiring user-access token, but they seem to expire after 3 months, no matter the "trick" I tried using.
Is there any suggestion of how I can get over it?
Maybe an automated api call that would refresh the token with no user interaction?
You can either use a Page Token (NOT a User Token) for the Page if you manage it - but it will expire. There is no way around that. OR you apply for Page Public Content Access so you can use an App Token.
Auto-refreshing would make the whole point of expiring Tokens pointless, you need user interaction for that.
So, I did it!
Now the how: I did it with the manage_pages access, not with Page Public Content.
I went back and forth a total of 5 times to get this to pass and a bit over a week.
First of all Page Public Content is only allowed by Facebook when you want to analyze data from other pages as well, so you better not mess with it.
What I had to do to get the request approved is specify on your application for requesting the access that there is no login, provide a copy of your code on the description and I also included a url where it was working with a user generated token through javascript, so they could review the code through a web debugger.
After that you get a manage_pages token which you can use to fetch your pages posts
I really hope some of those things were an overkill, but, like I said, I had to submit a review a total of 5 times, so on the last try I went all in...

Retrieve one's own facebook friendlist

Is there anyway for retrieving one's own facebook friendlist?
For example, a call to this URL would return my bio data https://graph.facebook.com/my_facebook_id. I'm looking for a similar method though it don't needs to be as easy as that. Using standard facebook API via authentication is absolutely out of question. Thanks for any help!
That would never work. The only reason you can see https://graph.facebook.com/my_facebook_id is because of how API privacy is structured around names (which always be public). If Facebook were to change its privacy model even that call would need authentication.
Getting a friend list without permission/authentication is a breach of privacy.

Can we post photos on friends wall using Graph API

Is it possible to upload photos on friends wall? The documentation never mentioned that! but its happening. I am able to post to the /friend_id/photos connection.
I am actually running my app on local server using localhost tunneling. So, in August, I made an app where people can post photos on their friends wall (upon their request only). So, As I was pretty new to FB API, I didn't notice that it is not allowed.
I just left the app for few weeks and came back to fix things and I noticed that I am unable to post photos to the /friend_id/photos connection (Its just not working. I am not getting any errors). Its not even working for other possible connections like /friend_id/feed Is my app restricted to some graph actions?
So, I just created a test app and executed the same connection /friend_id/photos and **its working. Don't know why!**
This is not the end of surprise:
I successfully posted a photo on my friends wall using my test app
When I opened the photo, I could see its from "Surya's Photos" - my photos
I don't see that photo in my albums. I just don't know where its actually saved.
Update 2: This is indeed possible (is it a bug?) the same regular way.
But seems that posting of photo to other user's /photos connection behave very differently from posting to /me/photos. Here are some of the facts about posting to /FRIEND_ID/photos:
Every photo published that way creates separated album named Posting User's photos (that's it uploaded photos will never be grouped and there is no way to see all of them in single place).
That photo will not be visible in albums of either user or friend, but only will be seen/accessible via feed/timeline.
And for sure this is only working if you able to post on that friend's feed
So it really behaves just like any other content posted to friend's feed.
I would say if you not rely on album functionality and persistance of those photos and only want to "share" photo on friend's wall, go for it (unless it's proven to be bug).
TL;DR; No you cannot post photo to friend's /photos connection. Well, you can post photo to friend's /photos connection but it will not behave the same way if posted to your's /photos.
According to documentation of photos connection for user:
Create
You can post photos to a user's Wall on their behalf by issuing an HTTP POST request to PROFILE_ID/photos with the publish_stream permissions and the following parameters.
Also according to documentation of photo object:
https://graph.facebook.com/USER_ID/photos - The photo will be published to an album created for your app. We automatically create an album for your app if it does not already exist. All photos uploaded this way will then be added to this same album.
So generally speaking you trying to upload photo to other user's album but you may only post photos to your profile (or to page if using access_token for page).
You may however post to feed of other user (for example post may or may not have picture as attachement, which isn't the same as photo).
Update:
Photos may only be uploaded to /USER_ID/photos than USER_ID is the same as me (owner of access_token).
Is my app restricted to some graph actions?
There’s some places where FB say in the docs or developer blog posts, “If you misuse feature xy, your app’s ability to use it may be revoked” (not literally; I’m paraphrasing here, but something like that).
So it’s absolutely possible, that FB revoked the ability to post photos to friend’s walls specially for your app, because too many users receiving photos on their walls this way have marked them as “spam”.
(“Revoking a permission” is maybe not the exactly correct wording here; I think it’s more likely the Graph API accepts the requests made from your app in the first place, but then silently filters it out in the back; that would also explain why you not get any errors.)

JS API - Any way to tell if a user is posting as himself, versus posting as a Page he adminsters?

I have a basic JS API application that posts a score update for a game to both a user's wall and a Page. In testing, one person who posted was posting as a Page, rather than herself, so the post to the Facebook Page showed up as being posted by the Page she was administering, rather than her own profile. So I'm wondering if there's any way to switch the "Voice" the user is using, via the API. I saw something about a profile selector attribute in one of my searches, but couldn't get the selector to show up, so either I was doing it wrong or it's been deprecated? Any help appreciated!

Getting Facebook Page Posts

I've written a bit of JavaScript that will fetch all of the posts on a Facebook Page. The URL with which I do that is this:
http://graph.facebook.com/cocacola/feed?limit=5&callback=facebookResponse
and this worked fine and dandy, right up until last week sometime, when I started seeing oauth errors.
I've searched for an hour or so on Stack, and seen plenty of other people are trying to do this, - but none have been asked after all of my requests to FB started returning these oauth errors.
It really doesn't make sense, - I'm trying to access publicly available data from company pages. I can still do so without oauth (albeit in a limited fashion) via RSS.
Anyhow, I'm hoping someone can clue me in as to how to get this PUBLICLY AVAILABLE information without having to go through the rigmarole of getting an application ID, an authorization token, etc.
This is a recent not-so-recent change, but you now need an access token to access /feed and /posts. Annoying, but at least it's navigable.
Edit: updated the link, which has broken in the many years since this post was relevant. Here's the relevant text from that post for future posterity:
Breaking change: Graph API PROFILE_ID/feed and PROFILE_ID/posts requires access_token
The Graph API PROFILE_ID/feed/ for a Page, Application, User or Group and PROFILE_ID/posts for a Page or User will now require a vaild [sic] access_token to access the wall or posts of the corresponding object (where previously no access_token was required). This will also affect direct FQL queries to the stream table, when querying for posts on a wall.
You will need to pass a valid app or user access_token to access this functionality. Please update your code if you are calling this API without an access token. This change will go live a week from today - Friday(June 3rd). We have updated the Roadmap to reflect this change.
Moving forward, you should always pass a valid app or user access_token with all API requests.

Categories