Facebook Share - Get just shared comment/description - facebook

I was looking for and I am interested is there any way to get just shared facebook description using maybe fb.ui/fb.init or some other way?
EXAMPLE: IMAGE LINK
After the share I could get the description on my website let's say this way:
document.write('The description you've shared!')
So maybe one of you know how to do it or maybe someone knows how to figure it out. I am really looking forward for it! Thanks!

When you use the feed/share dialog using FB.ui, you can specify a callback function that receives the new post's post_id. Then using the post_id, you can retrieve the contents of the post by using an FB.api call. So a basic example:
FB.ui({
method: 'feed',
link: 'https://developers.facebook.com/docs/dialogs/',
caption: 'An example caption',
}, function(response){
FB.api(response.post_id, function(resp) {
document.write(resp.description);
});
}
);
I'm not sure if all the fields are right, but that should give you the basic idea. Let me know if this makes sense :)
Feed and Share Dialogs: https://developers.facebook.com/docs/reference/dialogs/feed/
Post Object: https://developers.facebook.com/docs/reference/api/post/

Related

facebook feed response null

i am using below code to share fb feed
FB.ui({
method: 'feed',
link: 'https://developers.facebook.com/docs/',
caption: 'An example caption',
}, function(response){ console.log(response); });
response is always null i could not figure out why , i think when share done it must output some response
ref link : https://developers.facebook.com/docs/sharing/reference/feed-dialog/v2.5
Please guide if i am missing something
There is only a reliable callback if you authorized the user with the publish_actions permission. In that case, you will get the Post ID in the callback.
Else, there is no way to determine if a user shared something.
Keep in mind that you are not allowed to reward users in any way for sharing according to the platform policy: How to upload multiple images to one post in facebook via api

The posts fo Feed method in FB.ui are not visible in Facebook timeline

I created an Application in facebook and used in my website.
In my page I am using this function to share a photo.
function postToFacebook(url, img) {
FB.ui({
method: 'feed',
link: url,
picture: img,
name: "Sample name",
description: 'sample desc'
}, function (response) {
console.log(response);
});
}
This function is working and sending a ShareLink on my Time line. But nobody can see my post. I just can see the post on my TimeLine !!!
What it is the problem?
I found out the problem myself.
it is because of the Status of Facebook Application.
Do this setting to fix the problem:
Go to Facebook Developer => You Application => Status & Review => set this option to YES:
"Do you want to make this app and all its live features available to the general public?"

Facebook: share custom story doesn't appear in the wall

I'm having problems with the way the custom story that I have is displayed on Facebook.
It's working fine but instead of publishing on the wall of the user, it appears in the Recent Activity section.
The steps I follow until now:
create the custom action 'Want'
set the 'Explicitly Shared' option on
run this code:
FB.api(
'me/mynamespace:want',
'post',
{
article: "https://developers.facebook.com/docs?locale=es_LA"
},
function (response) {
console.log(response);
}
);
Can anyone help me?
If you need more info let me know. Thanks
You don't set explicitly shared to on. You need to do that in the API call.

Facebook API Error 100 'link' is invalid

I have my site qa.carryon.com (this is our test site). I have configured it for facebook login and send invitations. In facebook I have configured SiteURL as 'http://login.qa.carryon.com/gs/'. 'login.qa.carryon.com' is our CNAME and we are using Gigya as social third party.
Login is working fine and when users see the list of facebook friends, user will click on one of them and the facebook send dialog triggers. The link parameter for send dialog is something like this 'http://qa.carryon.com/loyalty/signup?userid=xghdt6ys&username=xyz'.
For this link am i getting the error code 100 link invalid or there is other issue in configuration. I am doing this for first time and i cant understand whats going on. Please help i am stuck with no clue.
I had this issue as well and I was using dynamic querystring parameters on a common URL. It seems you are doing the same.
I fixed the issue by forcing Facebook to scrape the URL before I attempt to send it via the FB UI Send Dialog. Use the FB API to hit graph.facebook.com with the URL posted in the id parameter and a scrape parameter set to true.
Like so:
FB.api('https://graph.facebook.com/', 'post', {
id: '[URL]',
scrape: true
}, function(response) {
FB.ui({
method: 'send',
name: '[name]',
picture: '[Picture URL]',
link: '[URL]',
description: '[description]'
});
});
Also answered here.
Does that help?

Select friends dialog

How can I select some friends using the Javascript API?
I'm working on a project where I want the user to select some friends which ID's I need, to display their profile images and names (among other things).
How do I do this?
Thank you in advance.
This is how I managed this...
$(".friendSelect").click(function () {
FB.ui({ method: 'apprequests', message: 'Choose 9 friends!' }, function (response) {
console.log(response) //The friends
});
});
This article explains how to get setup and using the Facebook javascript SDK. Once you've got that up and running you will want to get a FriendList object. From here you can then get a User object for each person in the FriendList.
You may want to try googeling 'javascript graph api tutorial' for code examples