facebookfacebook-graph-apifacebook-wall

Posting to a friends wall on facebook privately using graph api


I wanted to post a feed to a friends wall from my app and set it as private, which is viewable to the logged in user and the friend. I want to do this using the new Graph api, I saw that if I set the "to" parameter in the feed post, it will be posted to the users friend wall.

I found a code here: http://forum.developers.facebook.net/viewtopic.php?id=56458 (Posted by VovaOnline) (link is dead, as facebook has taken down the forum)

$result = $facebook->api('/me/feed', 'POST', array(
            'from' => array(
                'name' => 'Vladimir Ageenko',
                'id'   => '100001308281502'
            ),
            'name'    => 'TEST NAME',
            'caption' => 'Test Caption',
            'description' => 'Test Description',
            'message' => 'This is test.',
            'privacy' => array(
                'description' => 'Vladimir Sergeevich',
                'value'   => 'CUSTOM',
                'friends' => 'SOME_FRIENDS',
                'allow'   => '100001338940933'
            )
         ));

I am setting the post type as "link". Can anyone tell me what is wrong in this code. One thing I know that "from" field has to be "to" and it has to be passed in a "data" variable. I am not sure how to do it. Can any one help me?


Solution

  • I don't think Facebook allows you to do this currently. Look at the graph API docs on Posting:

    http://developers.facebook.com/docs/reference/api/post/

    it says on privacy:

    "Note: This privacy setting only applies to posts to the current or specified user's own Wall. Facebook ignores this setting for targeted Wall posts (when the user is writing on the Wall of a friend, Page, event, group connected to the user). Consistent with behavior on Facebook, all targeted posts are viewable by anyone who can see the target's Wall. "

    I interpret this to mean that if you post on someone else's wall (feed), privacy is out of your control.