Facebook wall post with object attachment using iOS SDK 3.5.2 - facebook

Facebook recently changed its publish API to prevent post on another user's wall and we should use their share dialogue.
Facebook documentation about publish
I need to share a photo to my friend's wall and I could achieve this using /USER_ID/feed post by specifying a post parameter named object_attachment. Now they have removed /USER_ID/feed post on another user's wall.
So my chances are to follow their share dialogue. But share dialogue will not accept object_attachment parameter of any kind and I can not share photo to my friend's wall or timeline.
Can any one help me?

As you rightly mentioned, Facebook have removed the ability to post via the graph API to another user's feed.
You can, however, use their FB.ui({ method: 'feed' }) feed dialog Javascript dialog combined with target_id: to prompt the user to post to one of their friends' walls.
The accepted parameters are listed on the documentation page and no, you can't attach anything.
One alternative is to create a unique resource for each photo you would have uploaded which contains open graph meta tags, with which you can describe a thumbnail (og:image and og:image:secure_url).
Another alternative is to upload the photo to the current user's album, then to tag the user's friend in that photo:
//Tag friend_to_tag_id at position (x_coordinate, y_coordinate)
$post_url = "https://graph.facebook.com/"
.$photo_id . "/tags/" . $friend_to_tag_id
. "?access_token=". $access_token
. "&x=" . $x_coordinate . "&y=" . $y_coordinate . "&method=POST";
$response = file_get_contents($post_url);

Related

Some public wall posts missing in facebook api response

I use the facebook api to crawl post from one page wall. The post will be published by random facebook users. The posts are shown on a landingpage.
That work's very fine for the first dev tests. But since we have switch into a live version (now random user write posts) where are some posts that are not in the facebook api's response.
My first thought was that the privacy setting of the post is not public. But then I shouldn't see it when I am logout.
Why I didn't see that few posts? Have someone a tip?
$url = '/' . $pageId . '/feed?fields=from, message, id, link, type, created_time, updated_time, shares, object_id,comments.limit(1).summary(true),likes.limit(1).summary(true)&since=' . $since;
Try adding &filter=stream to your call.
Facebook will defaults to a "Top Story" feed which can hide some objects due to a low "score". This will force the return to be in a "Most Recent" style feed where all objects will be shown and in chronological order.
My Idea: Some posts are missing in the api because of the privacy setting of facebook user? Maybe because the profile is not visible for non-facebook users? The publicity of the posts on facebook wall is always public when i look at the facebook wall. Have somebody experience with that?

Publishing links using Facebook graph API display feed as attachment on Facebook fan page

I am try to publish link on Facebook fan page using graph API but it displayed as attachment not as normal feed which display thumbnail.
Where as when I try to publish same link on users wall it display properly showing image thumbnail.
Can any one tell me why Facebook graph API work differently.
Feed publish on FB fan page :
Feed on user wall :
Thanks to all, I am finally able to solve this issue, the issue was I am using {page_id}/feed method to publish link for video and image, which displayed as attachment on Facebook fan page.
Solution : {page_id}/links with parameters [link, message, picture]
Pls provide params you include in request to facebook. Maybe providing params as shown in answer to following question helps, i.e. picture?
Posting an embedded video link using the Facebook Graph API

Facebook photo feed

I was using FB api to post photos to my fanpage's news feed (http://www.facebook.com/MyApp/photos_stream), but from some time it stopped posting it to news feed and it just uploaded photos to some album (http://www.facebook.com/MyApp/photos).
This is the api command I was using before and after it was working, nothing has changed on my side.
$result = $facebook->api('/123456789/photos', 'post', $attrs);
So the question is, how to post photos to fanpage wall (timeline) properly and why it stopped working by itself?
Thanks
I had the same problem a few times ago.
In fact it was working but you have to go to your photo folder and accept the uploaded image.
In the album Facebook will show you a panel saying you have to approve those photos.
By doing this Facebook will publish the images on the timeline.
I know this is very annoying but I didn't find a better solution (I think Facebook has added a new security to avoid some abuses).
EDIT:
Look at the Facebook documentation.
You can post photos to a Page's Wall by issuing an HTTP POST request
to PAGE_ID/photos with the publish_stream and manage_pages permissions
and the following parameters.
Make sure you are using those two permissions and that your parameters are correct.

Uploading an image to friends' wall using Graph API

I would like to know the Graph API equivalent of the following action :
Go to a friend's profile page, click on "Add Photo" on their wall, then "Upload Photo".
I can upload images to my own wall and to my own albums, and I can also post messages and links to my friends' feed, but I can't figure out how to do this.
Any help would be greatly appreciated.
Thanks.
I was able to do it setting a "target_id" parameter, and uploading the image to "graph.facebook.com/me/photos". Then it does show up exactly as if it had been done the manual way.
The only thing I'm not sure about is if "target_id" is some legacy parameter from the REST API that will become unsupported in the future...
I believe that process adds a photo to one of your albums; then attaches that to a Post on your friend's 'feed' connection
You can find documentation for both of those steps on the developer site:
Upload Photo: https://developers.facebook.com/docs/reference/api/user/#photos
Post on wall: https://developers.facebook.com/docs/reference/api/user/#posts - see the 'object_attachment' parameter here

What is the API for Facebook 'profile stream' aka wall posts?

Is there an API call, and if so, which call to get the 'posts to my wall from myself and others' on Facebook? It seems like it could be filtered out of the Facebook stream API, but it's not clear how that works to me.
This link seems to imply it's possible:
http://developers.facebook.com/news.php?blog=1&story=225
You want to do an FQL query like this:
SELECT actor_id, message FROM stream WHERE source_id = <user id> limit 50
You will probably want to select a few more fields, you can see what is available here: http://wiki.developers.facebook.com/index.php/Stream_%28FQL%29
Here it is.
Profile feed (Wall): https://graph.facebook.com/me/feed?access_token=...
https://developers.facebook.com/blog/post/465
You can publish stories to people who like your Open Graph Page the same way you write a Facebook post from your own wall. The stories appear in the News Feeds of people who have clicked the Like button on the Open Graph Page.
You can also publish using our API. If you associate your Open Graph Page with a Facebook app using the fb:app_id meta tag, you can publish updates to the users who have liked your pages via the Graph API.
First you need to get an access token for your app.
Check out the blog post, it covers everything you need.