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

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.

Related

Facebook Share - Get just shared comment/description

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/

Facebook-login issue

This is our link for the fb or old way sign-in: http://www.greeceinsiders.com/login
Does the fb-login work to you? When I click it it redirects me to the same page.
Sometimes it works sometimes not. When a user logs in with fb we collect his vredentials sucha as email,city, name in our mysql database. Does anybody had the same problem? Is there any good tutorial out there, that explains it step by step and is for the current fb api?
Any suggestions or feedback is welcome, thank you! Some code
FOUND IT!
I like to use the FB.login method. This allows me to set the permissions that I want (such as email) and access the info on my server through a Facebook library like https://github.com/facebook/php-sdk. There are also good tutorials on https://developers.facebook.com/docs/authentication/:
FB.login(
function(response) {
if (response.authResponse) {
$.ajax({
url: Global.base_url + 'user/facebook_log_in/',
dataType: 'json',
success: function(data) {}
});
}
else {
// Display facebook error
}
},
{
scope: 'email'
});

Adding a Facebook comment on a URL and have it displayed on user profile

I am creating a web application that displays a list of images taken from Flickr and I would like a user to login through Facebook and allow them to comment on those images. I was able to get the login/authentication working but I am now having trouble to enable a user to add a comment (as oppose to a Facebook 'post') on a Flickr image and have this activity show up on the user's Facebook profile/feed (i.e "John Smith commented on a link").
Here is what I have so far:
var fbCommentApi = '/me/myappname_ns:comment?access_token=' + fbUserToken + '&method=post' + '&picture=[WEBSITE_URL]' + selectedItemId;
FB.api(
fbCommentApi,
'post',
{ message: txtObj.value },
function (response) {
if (!response || response.error) {
alert("Sorry, there was a problem. Please try again later. [API]");
}
else {
alert("Thank you. Your comment will appear shortly");
hideCommentBox(txtObj);
}
}
);
The above code doesn't create a comment but instead it creates a post on the user's timeline with the URL attached. So when I try to retrieve comments for the WEBSITE_URL item through Facebook Graph...
'https://graph.facebook.com/comments/?id=[WEBSITE_URL]' + itemID
...I end up with empty data being returned.
I have an Action Type called 'Comment' in my Facebook app and that's the action I am using when trying to add the comment.
Thanks in advance and I look forward to your answers.
UPDATE 1: It seems now that if I use Facebook Graph this way.. graph.facebook.com/me/appname_ns:discuss?access_token=[TOKEN]&website=[URL]&met‌​hod=post
..it would just add an entry to the user's Activity box in their timeline, I didn't even pass a comment or message parameter to the URL as a query string parameter. That could be part of the problem.
UPDATE 2: According to another StackOverflow question, there seems to be no way to get a view of all actions done by all users, it has to be done per user (an API call per user). Therefore another way of handling this particular issue is to save the comments (or whatever action performed) to our own database.
Well, an Open Graph action is not a comment, even if you name it comment …
If you want a real Facebook comment, then either get a reference to an object that actually can be commented upon; or substitute comment with post/link post.

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

Hide content from non-fans in a Facebook *IFrame* (Not FBML)

it is incredibly easy to hide content from someone who does not like your application...if you're using FBML. I'm using an iFrame and the JavaScript SDK, and am having terrible difficulty figuring this out.
The behavior I'm seeing (both logged in and out) is that does not seem to be supported by FB.XFBML.parse(). Am I mistaken or is there an alternative method I can use that does not require the user to give explicit permission?
Finally figured it out!
After you have initialized the api (using FB.init()) simply do the following:
FB.api('/mypage', function (response) {
FB.api({ method: 'pages.isFan', page_id: response.id },
function (response) {
alert(response);
});
});
When the '/mypage' response comes back, it has the page id of the profile. Use that in the pages.isFan call and it will return a boolean object telling you if the current user has Liked that page or not.
No need to deal with authentication, extended permissions, or any FQL.