Post to facebook feed for a user that is logged in - facebook

I have a FaceBook game that is done in SilverLight. It makes a call to JavaScript from the SilverLight HTML bridge. I do not want an UI that asks the user for a comment, I just want their score that was passed from the SilverLight app to post on their feed. The following code does nothing. It does not throw an exception, but does exactly nothing.
Any help you can send my way that will explain how to fix this so that it posts to a users feed without UI would be greatly, greatly appreciated.
function PostToFeed(strCaption)
{
function callback(response)
{
}
var obj =
{
method: 'stream.publish',
// was using method: 'feed',
link: 'https://apps.facebook.com/blackjackguru/',
picture: 'https://metamorphosisapps.com/blackjackguru/BlackjackIcon.gif',
name: 'Blackjack Guru Accomplishment',
caption: strCaption,
message: 'I love this game!',
description: 'Play blackjack with the best blackjack game on FaceBook.'
};
FB.ui(obj, callback);
}

var obj =
{
link: 'https://apps.facebook.com/blackjackguru/',
picture: 'https://metamorphosisapps.com/blackjackguru/BlackjackIcon.gif',
name: 'Blackjack Guru Accomplishment',
caption: strCaption,
message: 'I love this game!',
description: 'Play blackjack with the best blackjack game on FaceBook.'
};
FB.api('/me/feed', 'post', obj , function(response) {
if (!response || response.error) {
alert('Error occured');
} else {
alert('Post ID: ' + response.id);
}
});
have you tried this? this just posts to user feed without any questions :)

Related

How can I post feed to other user wall by javascript sdk

I've succeed to publish feed to my wall but not to another user wall
I've defined both 'from' and 'to' variable
but I got error message when publishing the feed which said
"An error occurred. Please try again later."
here is my code when publishing
var obj = {
method: 'feed',
link: 'http://apps.facebook.com/' + fb_app_id,
picture: app_url + 'icon/test.png',
from: facebookid1,
to: facebookid2,
name: 'Test App',
caption: 'This is a test!!',
description: 'Test to publish feed to other user wall'
};
function callback(response) {
// Callback after feed posted...
}
FB.ui(obj, callback);
I don't know what is wrong or their are any extend permission required ?
try this code
FB.ui( {
method: 'feed',
name: name,
link: link,//Link is any link you want to post
picture: picture,
caption: caption,
description: redemption,
message: message,
to: page_id,
from: page_id
},
function (response) {
if (response && response.post_id) {
alert(response.post_id);
} else {
}
}
);
also if a user have set privacy that no once can post anything on their's wall, you'll unable to post in this case

Facebook API feed dialog - prevent unnecessary click

hi,
Using Facebook's API it's possible to prompt a user to post to his/her wall using the feed dialog. However, using the javascript SDK, this requires two clicks: one on the button which brings up the dialog, the other on the "Share" button within the dialog.
Is it possible to get rid of one of these clicks? I thought of two approaches:
Embedding the dialog within an iframe, as Facebook provides a URL for a full page dialog. That will require the user to click only on the "Share" button. Apparently Facebook blocks that option.
Using an access token and display=iframe, but I want to avoid the user having to authorize my application.
Any ideas?
i would suggest you to use fb.api instead.
function PostToMyWall(){
FB.login(function(response)
{
if (response.authResponse)
{
//Post to my wall
FB.api('/me/feed', 'post', {
message: lnk,link: lnk
},
function(response) {
if (!response || response.error) {
// //alert('Error occured');
} else {
// //alert("Successfully Posted to My Wall!");
}
});}else
{
alert('Not logged in');
}}, { scope : 'publish_stream' });
}
My application got a similar function, check it out at www.wootube.woolei.com - "Post to WooTube Page and Group"
or popup when the page using jquery
$(document).ready(function() { FB.ui({method: 'feed',
name: mdtxt,
link: lnk,
picture: hackImageUrl(img,fld),
caption: '<?php echo $clickme; ?>',
description: '<?php echo $app_desc; ?>'
},
function(response) {
if (!response || response.error) {
alert('Error occured');
} else {
alert("Successfully Posted to Group");
}
});});

Facebook App Stream_publish

I'm trying to make my facebook application autopost to a wall after they have accepted the permissions, ived tryied alot of things but i just cant get it working.
This is one of the things ived tryid:
FB.ui(
{
method: 'feed',
to: friendId,
name: 'title',
link: 'http://host.com/title_link.com',
picture: 'http://host.com/image.jpg',
description: 'description',
caption: 'caption',
},
function(response) {
// Check for a posting to wall
if (response && response.post_id) {
// do some logging
}
}
});
Is there anyone that got a sample code :)?
Maybe, your example is not working because there is one comma too much after
caption: 'caption'
.

Sencha Touch and Facebook button

I need to create a button to submit a comment on Face Book wall.
I am using MVC in Sencha touch and in my controller I use a function as
facebookComment: function()
{
--------
}
This function is to be called when a button is pressed.
Can any body please throw some light on how to go about this?
i am using following code to post on friends wall see if it is useful to you or not
var postParams = {
method: 'stream.publish'
, target_id: friend_id
, display: 'popup'
, message: message
, user_message_prompt: "Post message!"
}
FB.api(postParams, function(response) {
if(response.error_code || !response) {
to handle error
}
});
or refer this link https://developers.facebook.com/docs/reference/rest/stream.publish/
Well, first you should already be using the Javascript SDK. Then just issue a HTTP POST request to the feed connection of the current user using the FB.api() method with the message field set to your comment:
var body = comment_var;
FB.api('/me/feed', 'post', { message: body }, function(response) {
if (!response || response.error) {
alert('Error occured');
} else {
alert('Post ID: ' + response.id);
}
});
Obviously, should be taking care of the user login status (maybe using the method FB.getLoginStatus()).

Facebook Javascript SDK: Tag another user in my wall post?

We are using the Facebook Javascript SDK to allow users to post content to their wall. In the message that gets posted, is it possible to tag another user, similar to how you can when typing a post on facebook.com? (using something like #person)
We are using:
FB.api('/me/feed', 'post', { message: 'This post came from a test. #someuser'}, function(response) {
if (!response || response.error) {
alert('Error occured');
} else {
alert('Post ID: ' + response.id);
}
});
The end result would then be a post that tagged the #someuser user.
The Facebook API doesn't currently support tagging of users like this. That functionality is limited to the actual site itself.