Publishing on users time line using facebook javascript sdk
I have been using Graph API along with javascript facebook sdk to make posts on users wall. The code looks like this
function graphStreamPublish(){ showLoader(true); FB.api('/me/feed', 'post', { message : "Sample Message", link : 'link url', picture : 'image url', name : 'app name', description : 'Test stuff' }, function(response) { showLoader(false); if (!response || response.error) { alert('Error occured'); } else { alert('Post ID: ' + response.id); } }); }
Can this piece of code be used to post on users timeline as well or is there something else I need to do?
The following code works. ( Notice the 'publish_actions' permission used at the end).
FB.login(function(response) {
// handle the response
if (response.status === 'connected') {// Logged into your app and Facebook.
FB.api('/me/feed', 'post',
{
message : "Sample Message",
name : 'app name',
description : 'Test stuff'
},
function(response) {
if (!response || response.error) {
alert(response.error);
} else {
alert('Post ID: ' + response.id);
}
});
}
}, {scope: 'public_profile,email,publish_actions'} );
多年前,您可以将字段TO与用户标识一起使用,但现在您无法发布到用户时间表,但是您可以使用带有标识的“字段”来发布组,事件或页面。
链接地址: http://www.djcxy.com/p/60026.html