Reputation:
I am fetching a user's news feed using the Facebook API and displaying some of the data on a page. However, I am having trouble with wall posts. The data returned by the API considers a wall post to be a "status" update by the user posting, and the data does not include a field to say who the wall post is written to. Is it possible to query an item to check whether it is a wall post or not? Or is there a way I can receive the name of the recipient?
Here is the code I am using to fetch the user's news feed:
FB.api('/me/home', function (response) { console.log(response) });
A wall post will just give me message
(content of the wall post) and type
of status
. For example:
If Oliver wrote on John's wall, saying: "Hi", Facebook gives me:
{
from: {
name: "Oliver"
},
message: "Hi",
type: "status"
}
There's nothing to tell me it is a wall post nor who the recipient is. The result does include some other arbitrary data but none of that helps (id
, created_time
, etc.)
Upvotes: 14
Views: 35539
Reputation: 31870
Facebook has made this topic overly confusing. Just reading their documentation on the user object in the Graph API leaves you guessing: http://developers.facebook.com/docs/reference/api/user/
/user/feed The user's wall.
/user/home The user's news feed.
UPDATED: /user/home endpoint is now deprecated [07.06.2020], looks like there is no any possibility to get news feed now, see graph api user news feed
/user/statuses The user's status updates.
Why they couldn't have the "wall" /user/wall and "news feed" /user/newsfeed "status updates" as /user/statusupdates to make is simple I will never know!
So to get a list of status updates, do an HTTP Get to http://graph.facebook.com/me/statuses?access_token=ValidUserAccessToken
for the current user.
To get a list of wall stream items, do an HTTP Get to http://graph.facebook.com/me/wall?access_token=ValidUserAccessToken
for the current user.
To get a list of home feed stream items, do an HTTP Get to http://graph.facebook.com/me/home?access_token=ValidUserAccessToken
for the current user.
When you come across the "from" and you wonder who it's to, it's "to" the user who's access token you're using when calling /me/....
or if your calling with a specific ID /UserId/...
then it will be the user id for the "to".
Another thought: Grab the complete object from the stream FQL table object (developers.facebook.com/docs/reference/fql/stream) and see if there's some information there that's not exposed via the Graph object.
Upvotes: 33