Search code examples
facebookfacebook-graph-apifacebook-appsprivacy

Facebook app: change post-on-wall privacy


I am using this function to post on my own wall, and I would like to set the privacy of the post to FRIENDS. But it doesn't work. Always keeps the default app privacy (PUBLIC). How can I change this?

Thanks

function postToWall(message, header) {
    FB.ui(
            {
                method: 'feed',
                caption: header,
                link: 'http://www.iflikeu.com',
                picture: 'http://myapp.herokuapp.com/common/images/icon.png',
                description: message,
                privacy: {'value': 'ALL_FRIENDS'}
            },
            function(response) {
                /*if (response && response.post_id) {
                    alert('Post was published.');
                } else {
                    alert('Post was not published.');
                }*/
            }
    );
}

Solution

  • Your example is a call to FB.ui() which triggers the feed dialog - the user selects the privacy for such posts on a post by post basis

    If you're posting directly via the API you'd be calling FB.api() where you can set the privacy per-post directly; using the Dialog the user can always choose post visibility, and the value in the selector defaults to their default privacy setting for your app