我使用JavaScript Facebook SDK将数据从我的网站导出到Facebook。
我有一个条件,如果尝试将数据导出到组的用户没有权限,那么我想向该用户发送邀请以加入该组,以便他可以将数据导出到组页面。
问题是当我尝试在另一个组内调用组API调用时,就像我在组API调用中调用组API邀请用户一样,它显示的错误如“invalid token:”3073788727XXXXX“。已经指定了一个ID。 “那个id是我的Facebook群组ID。
CODE:
function postWallGroup(group_id,topicContent) {
params = {
message: topicContent,
};
FB.api(
'https://graph.facebook.com/' + group_id + '/feed/',
'post',
params,
function(response) {
if (!response) {
alert_4a('Error occurred.');
} else if (response.error) {
if(response.error.message === 'You do not have permission to post in this group.'){
FB.api('/me', function(response2) {
//getting user details to send invite
finviteId = response2.id;
//do invite user stuff here;
FB.api(
'https://graph.facebook.com/'+group_id+'/members/',
'post',
{
id: finviteId,
},
function(response3) {
if (!response3) {
alert_4a('Error occurred.');
} else if (response3.error) {
alert_4a(response3.error.message);
} else {
alert_4a('Success fully invited data to facebook group page.')
}
}
);
});
alert_4a(response.error.message+'<br/>'+'An invite has been sent to join this group. Only members of this group can export data.');
}
} else {
alert_4a('Success fully imported data to facebook group page.')
}
}
);
}