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'
.
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'm messing around with an Angular app, let's say for the sake of argument that I'm not using any meta tags, how can I use the Share Dialog to let users share pages of my app?
Using the old Feed Dialog works, but it has been deprecated:
$scope.share = function() {
FB.ui({
method: 'feed',
name: 'This is the name field',
link: 'The link',
picture: 'The picture',
caption: 'The caption',
description: 'This is the content of the "description" field, below the caption.'
})
},
function(response) {
if (response && !response.error_code) {
console.log('Posting completed.');
} else {
console.log('Error while posting.');
}
});
};
So even though this works, I want to use the Share Diolog in the same way but I'm not figuring it out. This is sort of what I've been trying, keep in mind that I'm a newbie:
$scope.share = function() {
FB.ui({
method: 'share_open_graph',
action_type: 'og.likes',
action_properties: JSON.stringify({
object: {
'title': 'The title',
'image': 'An image',
'url': $scope.shareUrl,
'description': 'This is the description',
}
})
},
function(response) {
if (response && !response.error_code) {
console.log('Posting completed.');
} else {
console.log('Error while posting.');
}
});
};
Any hints?
The short answer is that you can't, you must use OpenGraph meta tags.
Since Facebook doesn't understand JavaScript and thus Angular, you must detect Facebook's crawlers server-side and render a static page for them instead of the Angular app.
While the precise implementation will vary depending on your server technologies, here's the general idea:
Setup a route for the resources that need sharing: http://example.com/resources/:id
Look for the user-agent
If it's one of Facebook's crawlers, fetch the resource and render a simple view with OpenGraph tags and an empty body. Otherwise, simply render the Angular app.
Facebook's crawlers are available here and they currently are:
facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)
facebookexternalhit/1.1
Facebot
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
using Facebook Javascript SDK (since FBml doesn't work anymore), posting to a wall using my facebook app does not display name, description and caption at all. I tried adding a link and display, removed description as well, none seems to fix the issue.
Any help or note on this is helpful.
var description = $(this).parent().parent().children('.description').html();
var name = $(this).parent().parent().children('.name').html();
FB.ui(
{
method: 'feed',
attachment:
{
name: name,
caption: 'Test App',
description: description,
link: appLink,
href: appLink
},
action_links:
[
{ text: 'Test App', href: 'appLink' }
]
},
function(response)
{
if (response && response.post_id)
{
alert('Post was published.');
}
else
{
alert('Post was not published.');
}
}
);
This is actually a facebook bug. I've reported it to Facebook but haven't got any feedback since December 2011 after they've confirmed it a bug and assigned medium priority. Cheers.
Salam, Hi and Hello,
I am using FB.ui method of Facebook Javascript SDK and it says, "post to your wall", I want to publish story on facebook friend's wall or in feeds. So is it possible to post story on friends feeds other than your own wall? If yes then how? I doubt that it was only possible in depreciated libraries?
I am currently using following code:
FB.ui({'method': 'stream.publish',
'from':from_user_id,
'display':'iframe',
'attachment':attachment,
'description': '',
'message': message,
'user_prompt_message': "Personailze Message",
'action_links': [
{ text: 'AppName', href: canvasURL }
]
},
function(response){
});
A Dialog is appearing but it says, "Post to Your Wall"
But What I want is that it say post to Your wall and Your Friends Home Page? as here:
http://thinkdiff.net/facebook/graph-api-iframe-base-facebook-application-development/
I followed this tutorial but it is still saying: "Post to Your Wall"
So is there any clue? That How can I achieve the intended functionality? Waiting for your response.
thanks in advance
thanks
If you want to post on any friends wall you have to add the friends id so it'll look like this
FB.ui(
{
method: 'feed',
name: 'NAME',
link: 'LINK OF THE WEBSITE OR PAGE',
picture: 'IMAGE_URL IF YOU NEED IT',
caption: 'Reference Documentation',
description: "DESCRIPTION",
to:FRIENDS_ID
},
function(response) {
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
}
);