We are able to post to any particular friend by providing the 'to' field in dialog feed syntax.
FB.init({appId: "", status: true, cookie: true});
function postToFeed() {
// calling the API ...
var obj = {
method: 'feed',
redirect_uri: [url],
link: 'https://developers.facebook.com/docs/reference/dialogs/',
picture: 'http://fbrell.com/f8.jpg',
name: 'Facebook Dialogs',
caption: 'Reference Documentation',
description: 'Using Dialogs to interact with users.',
to:[fb id]
};
function callback(response) {
document.getElementById('msg').innerHTML = "Post ID: " + response['post_id'];
}
FB.ui(obj, callback);
}
But how do we have a text box which allows the user to choose the friend to whom it has to be posted. Or is there any alternative way?