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
Related
I am trying to share image from FB app, using send dialog like I am doing for past few years.
var obj = {
method: 'feed',
link: 'https://www.facebook.com/pages/TESTPAGE?sk=app_XXXXXXXXXXXXXX&app_data=share|10',
caption: '',
name: 'Title for share',
description: 'description fort share',
picture: IMG_URL
};
I have provide 2 screenshots
when I click on share button inside of app
what I keep getting on my profile wall.
Until few months ago, FB would show data from feed method, but now, feed is acting just like share method: it shares url, without image and labels I sent through feed dialog.
All I want is to share image from app, and url of that image should point to app url.
Any suggestions?
I came across this issue from yesterday. The issue only happens when you pass in the FB app link url to the Link option. The works fine with the images as long as the link url is not anything related to FB.
So the workaround I found was to get a shortened URL from google and passed it instead of the normal app link.
FB.ui({
name: 'temp',
method: 'feed',
picture: '',
link: '{shortened url}',
caption: 'temp',
description: 'temp',
redirect_uri: 'any url'
}, function(response){
});
You can try this code to share image from FB app:
FB.ui(
{
method: 'feed',
display: 'popup', // must be one of "popup", "dialog", "iframe", "touch", "async", "hidden", or "none"
name: 'Title for share',
description: 'Description for share',
caption: 'www.facebook.com/YourFbPage/app_xxxxxxxxxxxxxxxxxxx',
link: 'http://PathToYourDomain.com/Folder/',
picture: 'http://PathToYourDomain.com/Folder/img/img-1200x627.jpg',
},function(response) {
if (response && response.post_id) {
// alert('Post was published.');
} else {
// alert('Post was not published.');
}
}
);
Best and good luck!
FB.ui({
method: 'share_open_graph',
action_type: 'og.shares',
action_properties: JSON.stringify({
object : {
'og:url': str_href,
'og:title': 'title', //galleryItem.title,
'og:description': 'desc', //galleryItem.description,
'og:og:image:width': '2560',
'og:image:height': '960',
'og:image': str_picture //BASE_URL + '/images/works/galleries'
}
})
});
I have a standard file-upload form, which I want to use to collect a user's image and than upload to Facebook.
If I post the upload form to the FB 'staging' url, I get the encoded staging reference - but when I try to launch a FB.UI() feed dialog, supplying the staging token as a "picture" parameter it fails?
Is the staging URL strictly for use in creating a graph object w/o using the dialog? And if I want do use the dialog do I have to upload the image somewhere else and than reference it ?
Here's my example:
$('#picture_upload').submit(function(e){
e.preventDefault();
$(this).attr('action',$(this).attr('action')+'?access_token='+accessToken);
$(this).ajaxSubmit({
success: function(response){
FB.ui(
{
method: 'feed',
name: 'Facebook Dialogs',
picture: response.uri,
caption: 'Reference Documentation',
description: 'Dialogs provide a simple, consistent interface for applications to interface with users.'
},
function(response) {
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
}
);
} //call function after success
});
});
The response contains something like:
{"uri":"fbstaging://graph.facebook.com/staging_resources/MDAxMDE1MTU3NjIyNzExNzYwNA=="}
Which is obviously invalid as a picture parameter in the FB.UI function
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 :)
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'
.
I'm using FB.ui to post to a Facebook user wall. However, I am uncertain on which parameters to use to post to a Page or Application wall. Any links?
I am trying to post to the Page wall as that page, not as the user's account.
Code to post to user account:
FB.ui(
{
method: 'feed',
name: name,
link: link,
picture: picture,
caption: caption,
description: redemption,
message: message
},
function (response) {
if (response && response.post_id) {
alert(response.post_id);
} else {
}
}
);
Got it:
you have to set the to and from values:
FB.ui( {
method: 'feed',
name: name,
link: link,
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 {
}
}
);
I used the JavaScript SDK to post on user's wall:
function graphStreamPublish(){
var body = document.getElementById("txtTextToPublish").value;
FB.api('/me/feed', 'post', { message: body }, function(response) {
if (!response || response.error) {
alert('Error occured');
} else {
alert('Post ID: ' + response.id);
}
});
}
When I go through the Graph API Page I think if you change '/me/feed/' to 'pageId/feed' then it may post the message in that page. I am not sure. - just a suggestion.
To share on a friend's wall, as of February 2012:
FB.ui({
method: 'stream.publish',
app_id: appId,
display: 'iframe',
name: name,
link: link,
picture: picture,
caption: caption,
description: description,
target_id: friendIds
});
To post to facebook wall use the following.. .
Call the below js function using simple call as in below
Post to Wall image/text?
//facebook: post to wall
function publishWallPost() {
FB.ui({
method: 'feed',
name: 'Your App Name',
caption: 'Caption Text',
description: 'Your description text',
link: 'https://www.facebook.com/link/link.link',
picture: fbImg
},
function (response) {
console.log('publishStory response: ', response);
});
return false;
}
window.fbAsyncInit = function () {
FB.init({
appId: 'Your App ID',
status: true,
cookie: true,
xfbml: true
});
};
(function () {
var e = document.createElement('script');
e.async = true;
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
Sorry, this is an old question, but I thought this might be helpful for people who find it via google.
http://fbmhell.com/2011/07/facebook-share-popup-iframe-tabs-jquery/
Just remember target_id needs to be parsed into an int. The response["to"] comes back as a string.