I am using JavaScript SDK to implement feed functionality. Here is my problem, if a user is logged-in and clicked on share button, Facebook is able to see the post in the timeline, but it is not reflecting in home page.
How can I solve this?
I am using this code -
FB.init({appId: "XXXXXXXXX",show_error:true, status: true, cookie: true});
function postToFeed() {
// calling the API ...
var obj = {
method: 'feed',
link: 'https://developers.facebook.com/docs/reference/dialogs/',
picture: 'http://fbrell.com/f8.jpg',
name: 'Facebook Dialogs',
caption: 'Reference Documentation',
description: 'Using Dialogs to interact with users.'
};
FB.ui(obj, callback);
}
You can't decide what appears on the homepage. It depends on the users settings and on how Facebook decides to promote certain types of content.
The homepage is just a condensation of all your friend's/subscription's/page's timelines'. When you share a URL - you share it on your timeline and never share it to the homepage.
This is the expected behavior.
If your application posts something to a users timeline, it is most likely that his/her friends will see it on their homepage but there is currently no way to ensure this. Take for example a situation where one of your users share's a URL but their friends only come into Facebook 2 days later - you can't expect that story to still appear on their homepage after so much time has passed. Like I said - it is likely going to appear on the homepage at some stage - but you have no control over that.
Related
I can post a photo IF I had the time to get an app approved. I can share a link that pulls in a photo from THAT page. The goal is to post a link that goes to X, but the image is hosted somewhere else.
Is this possible?
Yes, it's possible by using the JavaScript SDK and the Share Dialog. For example, I can do the following, which shares a link but with a custom image, name and caption. It basically overwrites all the OG data on my page.
function fb_share() {
FB.ui( {
method: 'feed',
name: "Facebook API: Tracking Shares using the JavaScript SDK",
link: "https://www.webniraj.com/2013/05/11/facebook-api-tracking-shares-using-the-javascript-sdk/",
picture: "https://stackexchange.com/users/flair/557969.png",
caption: "Tracking Facebook Shares on your website or application is a useful way of seeing how popular your articles are with your readers. In order to tracking Shares, you must used the Facebook JavaScript SDK."
}, function( response ) {
// do nothing
} );
}
$(document).ready(function(){
$('button.share-btn').on( 'click', fb_share );
});
You can do the same thing in PHP if you have the publish_actions permission approved by Facebook. Both would produce the following result:
Source
I've set up Facebook login on my site, and have done a couple of test wall posts when certain user actions occur. I tested it on my FB account, and the posts turned up on my wall (good).
Immediately I had a couple of friends email saying, 'how do I turn these notifications off, they're filling up my feed'.
I'm guessing this isn't a good way to promote my app - it'll piss people off. Unless I have an option at the time of the app action for the user to say 'yes, post to my wall.'
I notice that my posts were also coming up in the activity ticker (on the right of your profile page), and that a lot of game apps post player activity there - is it possible to just post to that and not to the wall? If so, what do I code instead of "/me/feed", "post"?
Thanks
In the activity ticker it is actually the updates from the Users or pages or apps are displayed which actually come from , if you go back to their wall and see, their respective wall.
Feeds are usually the updates and those also come from wall.
One thing which you can do is when providing permission to your app you can make it visible to you only(Only me option) so that none of your friends gets it in his/her feed.
Otherwise there is no other way for now.
Instead of directly making a post through graph API use Fb.ui feed method. This will open a popup dialog which user can accept to be published on wall or cancel:
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.');
}
}
);
note:all links here should point to domain specified by you in canvas url
A better approach would be to use open graph actions instead a just posting a story on wall. Open graph actions are seen in Activity section of your timeline. The stories are small hence does not seem like spamming user wall. If the number of posts is high it is aggregated/clubbed together.
i am trying to add the stream.publish functionality to my web app, but i'm having a problem with the 'feed' dialog.
My code is the following:
var obj = {
method: 'feed',
display: 'iframe',
name: data.name,
link: data.link,
picture: data.picture,
caption: data.name,
description: data.description,
message: data.message,
actions: [{
name: data.actions.name,
link: data.actions.link
}],
user_message_prompt: ''
}
var resp = FB.ui(obj, function(response) {
alert("DONE");
});
I can make it work if i use 'popup' instead of 'iframe' but that's not what i want.
Any ideas why the feed is just not appearing in my screen???
Thanks!
As described in Dialogs documentation
If you specify iframe, you must have a valid access_token. To get a valid access_token, please see the Authentication guide
Update:
Seems there is couple of other statements that may lead to this behaviour:
iframe: Display the dialog in a lightbox iframe on the current page. Because of the risk of clickjacking, this is only allowed for some certain dialogs, and requires you to pass a valid access_token.
And this one.
On Facebook canvas pages, Dialogs are supported only for iframe applications
There is also open BUG #246637628719849 about "Send Dialog" not working with as iframe in Page Tabs (which may, or may not be related).
Update2:
Actually in all my applications I've user FB.ui without specifying display since at the time of implementation of Dialogs iframe wasn't working well in most cases, and without it Facebook JS-SDK trying to use most appropriate display mode...
Update3:
OP had fb-root within other DOM element which was hidden, causing Dialog to be invisible (as he stated in comment)
I know this has been asked several times before, but Facebook changes its api often so comes the necessity to ask this question again.
I have an iframe application, how to make users select their friends and post on their wall the message which comes out of my application in facebook using FB.ui ? or some other better method.
The simplest way to do this is via the "send" widget. http://developers.facebook.com/docs/reference/plugins/send/
If you have the stream_publish right from the user, you can also fetch his friends, let the user selects the friends he wishes to post to, and than in a loop you post to this users via graph api on the wall. (without the stream_publish right, you would have to open a fb.ui for EACH of the friends the user wants to post to.
for share to friend:
FB.ui({
method: "apprequests",
display: "iframe",
message: 'take a tour to my app',
data: '123'
});
for post to wall:
FB.ui({
method: 'feed',
link: 'http://myapp.com',
display: 'iframe',
message: 'take a tour to my app',
name: 'Click to view my app',
caption: 'Hello my app'
});
I want to create a post to a user's wall via my facebook connect mobile app. I looked on the FB developer's website and only found this to post through mobile:
http://www.facebook.com/dialog/feed?
client_id=YOUR_APP_ID&redirect_uri=YOUR_URL&display=touch
along with this statement The current version of the JavaScript SDK does not yet supporting automatically selecting the correct dialog for the user's device. We expect to add this capability shortly.
Has this been fixed yet? I have been trying to workaround using the normal method:
//Post on user's wall
FB.ui(
{
method: 'feed',
name: 'MyApp',
link: 'myURL',
picture: 'http://fbrell.com/f8.jpg',
caption: caption,
description: message,
message: ''
},
function (response) {
});
But it is slow and doesn't work the way I want it to.
Suggestions?
As of now no the cannot. You can still do auto publish posts though.