Facebook - Posting to a Group page
I am attempting to post on a group page using the FB JS API, basically the user selects the group they want to post onto, and it posts it to the wall.
i am doing:
FB.ui(
{
method: 'stream.publish',
from: myId,
to: groupID,
attachment: {
name: 'Post to a group Test,
href: 'http://www.test.com'
}
});
But when i try it, it says:
An invalid target was specified: <(groupid)>. The target must be a page, event, or user that the actor can post on the wall of开发者_运维百科.
Thou, i know i can post on the group page, so i dont know why it says that.
And i am not talking about fan pages, i can post on them ok setting the from and to as the same thing (posting as an admin).
Is this possible? or am i just doing it wrong?..
Thanks,
Andrew
It seems that both stream.publish
and feed
methods are not supported for groups object so your best solution is to use (for example) the jQuery UI Dialog component with the fields you need to post to the group as inputs and on the submission use the FB.api
method:
FB.api("/group_id/feed", 'post', { name: nameVar, link: linkVar }, function(response) {
if (!response || response.error) {
alert('Error occured');
} else {
alert('Post ID: ' + response.id);
}
});
I'm not experienced, with the facebook API, but what is the value of the groupID variable? is it "(groupid)"? If not, then it is a really unclear error message - and I wonder how the API knows that you tried to post on a group. If so, then there you have it ;-) You should fill in a group id.
According to the documentations, Facebook groups are not mentioned in the list of possible targets to publish to. I filed a bug to hopefully get Facebook to address this:
http://developers.facebook.com/bugs/158247050931954
精彩评论