[英]Is it possible to post to pages that you are an admin for using the Facebook Javascript SDK?
I am able to write on my own wall but not on the wall of pages I am an admin for. 我可以在自己的墙上写字,但不能在我作为管理员的页面墙上写字。 I am using the code below (Javascript SDK):
我正在使用下面的代码(JavaScript SDK):
FB.ui(
{
method: 'stream.publish',
message: 'getting educated about Facebook Connect',
attachment: {
name: 'Connect',
caption: 'The Facebook Connect JavaScript SDK',
description: (
'A small JavaScript library that allows you to harness ' +
'the power of Facebook, bringing the user\'s identity, ' +
'social graph and distribution power to your site.'
),
href: 'http://github.com/facebook/connect-js'
},
action_links: [
{ text: 'Code', href: 'http://github.com/facebook/connect-js' }
],
user_message_prompt: 'Share your thoughts about Connect',
target_id: '170500829645508',
uid: '100001920038281'
},
function(response) {
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
}
);
}
Where target ID is the page I admin and uid is my account user id. 目标ID是我管理的页面,而uid是我的帐户用户ID。 When I run this code I keep getting the error message:
当我运行此代码时,我不断收到错误消息:
An invalid target was specified: 170500829645508. The target must be a page, event, or user that the actor can post on the wall of.
指定了无效的目标:170500829645508。目标必须是参与者可以在其墙上张贴的页面,事件或用户。
Am I doing something wrong here? 我在这里做错什么了吗?
You need the manage_pages extended permission to do this. 您需要manage_pages扩展权限才能执行此操作。 Once the permission is granted you can query graph.facebook.com/me/accounts to retrieve an API token that can post to a page's wall.
授予权限后,您可以查询graph.facebook.com/me/accounts来检索可以发布到页面墙的API令牌。 Check out Facebook's extended permissions here: http://developers.facebook.com/docs/authentication/permissions .
在此处查看Facebook的扩展权限: http : //developers.facebook.com/docs/authentication/permissions 。
I ended up using this method which works for posting to a page that I admin. 我最终使用了这种方法,该方法适用于发布到我管理的页面。 Haven't figured out how to include attachments this way though...
虽然还没有弄清楚如何以这种方式包括附件...
var wallPost = {
access_token: ".........................",
message: 'Here is some more stuff'
};
FB.api('/me/feed', 'post', wallPost, function(response) {
if (!response || response.error) {
alert('Error occurred:' + response.error.message);
} else {
alert('Success!');
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.