在用户时间线上使用facebook javascript sdk发布
我一直在使用Graph API以及javascript facebook sdk在用户墙上发布帖子。 代码看起来像这样
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);
}
});
}
这段代码是否可以用于在用户时间线上发布,还是还有其他需要做的事情?
以下代码有效。 (请注意最后使用的'publish_actions'权限)。
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/60025.html上一篇: Publishing on users time line using facebook javascript sdk
