So I am using facebooker2 plugin to do facebook connect. I was able to extract information about a user, but here's what I have been struggling with...
I am not sure how to post something onto my wall or my friends' walls.. I know that in facebooker, you can call the method publish_to and it will do the job. But it seems like facebooker2 is a little bit less documented as I looked all over google..
I was wondering if any expert who could help on this one?
Thanks alot
if Your using facebooker2 which integrates Facebook Connect You'll probably need to do it on the client side. if I understand correctly facebooker2 does not provide any server side API.
thus load the JavaScript SDK (should be loaded if You've succesfully connected) and go ahead posting statuses with the integrated Facebook UI :
FB.ui({
method: 'stream.publish',
attachment: {
name: 'JSSDK',
caption: 'The Facebook 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.'
)
}
},
function(response) {
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
}
);
FB.ui
supports the following dialogs :
if You wan't to publish a status update to the feed directly without the fancy UI use the FB.api
function :
var body = 'Reading Connect JS documentation';
FB.api('/me/feed', 'post', { message: body }, function(response) {
if (!response || response.error) {
alert('Error occured');
} else {
alert('Post ID: ' + response.id);
}
});
UPDATE:
actually You could do all this server side - i did not notice Mongli at first - integrates FB Open Graph API (facebooker2 gem depends on it), sample controller action :
def create
note = current_user.sent_notes.create!(params[:note])
flash[:notice] = "Note sent to #{note.recipient.email}"
if current_facebook_user
current_facebook_user.fetch
current_facebook_user.feed_create(
Mogli::Post.new(:name => "#{current_facebook_user.name} sent a note using notes!",
:link=>note_url(note),
:description=>truncate(note.body,:length=>100)))
end
redirect_to notes_path
end
@see Mogli at https://github.com/mmangino/mogli
@see facebooker2 example at https://github.com/mmangino/facebooker2_fb_connect_example