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: ''
}
});
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
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.'
}
});
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
Share Improve this question edited Jan 26, 2011 at 11:32 Richard Ev 54.2k61 gold badges194 silver badges281 bronze badges asked Jan 26, 2011 at 10:54 AndyAndy 4431 gold badge6 silver badges21 bronze badges3 Answers
Reset to default 5It 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 ponent 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./bugs/158247050931954