Facebook Graph API Post to friends wall

facebookfacebook-graph-apirest

is it possible to post a message on some other user's wall as currently logged user? I'm able to post a message but it appears like that the other user has sent it, not me.

It was possible with old API (via stream.publish method) but I'm unable to duplicate that functionality with the new API.

Thanks in advance!

Best Answer

You can do something like this using their JavaScript SDK:

var user_id = "123456789";
var data = {
    name: "title of post",
    caption: "caption of post",
    description: "description of post"
};
var callback = function (response) {};
FB.api("/" + user_id + "/feed", "post", data, callback);

This will send a message with the data provided from the user currently logged in, to the user with the user_id specified.

In order to be allowed to post, you need to publish_stream permission, which you can request dynamically, by calling

FB.login(null,{perms: 'publish_stream'});