This question already has answers here:
facebook open graph action only shows up in "recent activity", not as individual post
(2 answers)
Closed 9 years ago.
I've made an app with open graph.
Once I publish an action, it doesn't publish on my wall.
It publishes on the activity feed instead.
Here is my code for publishing
function postCook()
{
FB.api(
'/me/[my app namespace]:cook?'
,
'post',
{ recipe: 'http://www.xxx.com/Sample.html'
,access_token : 'MY TOKEN'},
function(response) {
if (!response || response.error) {
alert( response.error.message );
} else {
alert('Cook was successful! Action ID: ' + response.id);
}
});
}
I also tried to follow the instruction here Tutorial
According to this tutorial, I've seen that Open Graph can publish to News Feed.
But I cannot make my app publish to News Feed.
Do I have to set any parameters to force it to publish on News feed (on my wall)?
Which permission I have to request?
publish_actions or publish_stream?
Thanks,
You cannot force Open Graph actions to be published to the news feed. Facebook keep tight control over the feed and by default, your OG actions always get published to the activity feed. And sometime only do they reach the News Feed (of your friends - never seen mine in my own feed).
So that's it, you cannot force it. Although, don't worry too much about this, OG actions actually get published often enough to allow "virality" of your app, and good reach of new user. It's definitly better than a share action, even if this one get published to the News Feed instantly.
Related
I have a website with some dynamic urls (for example a page who show event details thanks to event id in get variable), but during the share with facebook, at the first attempt the thumbnail image doesn't appear due the page isn't already fetched by facebook.
Then I must go to the debugger https://developers.facebook.com/tools/debug/og/object/ and submit every pages to get a valid thumbnail to the users.
There's a script or a way to send multiple links to this debugger, or there's another way to achieve the indexing of new pages by facebook?
You can refresh the Open Graph tags with a POST request to the Graph API, i think it´s not in the Facebook docs (at least i could not find it) - but it definitely works:
$.post('https://graph.facebook.com', {
id: 'http://www.yourdomain.com/somefile.html',
scrape: true
}, function(response) {
console.log(response);
});
Just an example with jQuery, of course you can just use CURL on the server too.
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 have a small game in my website, and i want people to post their best time in facebook. To do this, i made an app, and then use the following link:
https://www.facebook.com/dialog/feed?app_id=363262997057304&name=Myname&link=http://www.mywebsite.com&redirect_uri=http://www.mywebsite.com&description=MyDescription
But i dont know how could I do it to populate the message field. what could I do?
The message parameter is deprecated,
also you can use FBJS API to post in a user feed,
function postToFeed() {
var obj = {
method: 'feed',
link: 'https://apps.facebook.com/APP_NAMESPACE/',
picture: 'https://domain.tld/75x75.jpg',
name: 'TITLE',
caption: 'CAPTION',
description: 'My Score: '+score
};
FB.ui(obj);
}
but you have to ask the user for publish_stream permissions first.
You are not supposed to prefill the message field, asper Facebook, unless from a natural flow, such as a user typing in a textbox and sending to the message field on a submit. You should use the description, caption fields for your purpose.
Since you have a game app, all you need to do is to publish their score using the games score API described here: http://developers.facebook.com/docs/score/
From: http://developers.facebook.com/docs/guides/games/
Scores and Achievements
Scores and achievements APIs are built on Open Graph and receive the
same distribution points that all Open Graph stories do - Ticker,
Newsfeed and Timeline. In addition to these scores and achievements
also benefit from built in aggregations and stories that have been
designed by Facebook.
I have a website where there is comments systems. I want to add a comment to facebook while adding a comment to my website.
If it is not possible to add to Facebook while adding to my site is it possible to show share to facebook button with each comments so that clicking on it will share that comment on facebook. May be possible with fb.in?
Not 100% sure, but it sounds like you have your own comment system on your web site and that you'd like to auto-publish to FB the comment that someone makes on your own site.
You'd need to implement the Facebook SDK on your web site:
Have your user authorize your site using 'FB.login' with 'publish_stream' permission (see docs).
In your comment system code, after your user has entered in their comment, you can make a separate call to the Graph API to publish to the user's feed. For example, if using the Facebook Javascript SDK:
Following is the code:
var body = myJustEnteredComment;
FB.api('/me/feed', 'post', { message: body }, function(response)
{
if (!response || response.error)
{
alert('Error!');
}
});