FB feed method does not work as it used to when sharing image and url - facebook

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'
}
})
});

Related

Facebook sharing: going from 'feed' to 'share_open_graph'

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

No feed dialogs in Facebook Messenger

I have a problem with the Facebook Messenger app. I have a mobile web app with two buttons, one for inviting friends (app request) and one for posting to the wall.
<a onClick="sendRequestViaMultiFriendSelector(1);">Invite</a>
<a onClick="postToFeed(1);">Share</a>
The functions are:
function sendRequestViaMultiFriendSelector(selectedPizza) {
FB.ui({
method: 'apprequests',
message: 'Message',
title: 'Caption',
data: {"pizza_id" : selectedPizza, "act" : 'redirect'}
}, requestCallback);
}
function postToFeed(selectedPizza) {
FB.ui({
method: 'feed',
link: 'link',
picture: 'src',
name: 'name',
caption: 'caption',
description: 'desc'
}, requestCallback);
}
function requestCallback(response) {
}
I test this by clicking on a link to the app (apps.facebook.com/namespace...) in a private message. This works in the Facebook iPhone App, but not in the Facebook Messenger App for iPhone. Nothing happens when the buttons are clicked.

FB.ui returns Error: element not specified

Using the example from the developer site:
FB.ui(
{
method: 'feed',
name: 'Facebook Dialogs',
link: 'https://developers.facebook.com/docs/reference/dialogs/',
picture: 'http://fbrell.com/f8.jpg',
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.');
}
}
);
I get the following back:
Error: element not specified
innerError: undefined
message: "element not specified"
At first I thought I was missing the "fb-root" element, but I have it in my body:
<body onLoad="onLoad()">
<div id="fb-root"></div>
</body>
Now I'm thinking it has something to do with my Backbone/jQuery Mobile usage, because the body is cleared once the first page is loaded. However, the FB object is loaded, so I really don't know what's wrong. Any ideas to try and fix this?
Thanks.
I had the same issue and I figured out that was happening just with Chrome. Which browser are you using?
What worked for me was specifying
display: 'popup'
inside FB.ui {}
At the moment I check the browser and if Chrome I use 'popup', if not 'iframe'
var display = 'iframe';
if (navigator.userAgent.toLowerCase().indexOf("chrome") != -1){
display = "popup"
}
FB.ui({
method: 'share',
display: display,
href: 'https://developers.facebook.com/docs/reference/dialogs/'
},
function (response) {}
);
Should work also with feed, but I haven't tested it yet.

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 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'
.