Populate facebook feed dialog message box - facebook

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.

Related

Share a Spotify track using the Facebook API

I've been using the Facebook API for quite a long time, I've managed to post to feed pictures, videos, and links, but my client wants to post a Spotify track through a Facebook App.
For instance, to share this track: http://open.spotify.com/track/5yEPxDjbbzUzyauGtnmVEC
When I copy this into Facebook's post input, it loads the correct song name and cover. However, if I use the FB.ui API call, it just doesn't share anything around.
var data = {
method: 'feed',
link: MY_FB_TAB,
name: name,
caption: caption,
description: description,
message: '',
picture: 'https://embed.spotify.com/oembed/?url=spotify:track:5yEPxDjbbzUzyauGtnmVEC',
source: 'http://open.spotify.com/track/5yEPxDjbbzUzyauGtnmVEC'
}
FB.ui(data);
Isn't just a way to share a track using the FB.ui dialogs?

Posting to user's wall - difference between wall and feed?

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.

How to format the Facebook news feed description of grouped app posts?

I have an app which posts a message like this to a user's Facebook timeline:
This is working fine, but if I post a few times, my posts get grouped on my news feed, and I get this:
What settings should I use to control the way this news report appears? Instead of 'All about periods' and the page link in the box at the top, I'd like 'Body iQ Quiz' and the app description. Where would I set these values?
And is it possible to make the grouped report say 'Jay cee Effex shared a link via Body iQ Quiz', the way the original post does?
I'm posting from the Facebook AS3 API, and my post code looks like this:
var auth:FacebookAuthResponse = Facebook.getAuthResponse();
var token:String = auth.accessToken;
var user:String = auth.uid;
var values:Object =
{
access_token: token,
name: "Body iQ Quiz",
picture: "http://a7.sphotos.ak.fbcdn.net/hphotos-ak-snc6/282950_427728213914009_630526316_n.jpg",
link:"http://www.lil-lets.co.uk/en-GB/Wellbeing",
description: "Women, how well do we know our bodies? Click here to find out what your Body iQ is.",
message: result.FacebookBody + " " + result.FacebookTitle
};
Facebook.api("/" + user + "/feed", handleSubmitFeed, values, URLRequestMethod.POST);
... but I'm not sure if this is something I can fix in code, or if the app configuration needs tweaking?
NOTE: Some users report getting the latter format in their news feed even with a single post (I can't reproduce this), so perhaps grouping is a red herring, and the real question is how to format the news feed report of a timeline post?
If and when to group posts or photos is a decision Facebook makes.
(Some people suggest that grouping does not occur, if the user logs out of Facebook between making posts – but demanding or even forcing that is not a user-friendly way to behave for an app.)
In your case, I guess the reason for grouping occurring is, that it is always one and the same URL you are posting. Maybe you can avoid grouping, if you post different URLs each time – could be achieved by just adding a meaningless GET parameter to the URL. But beware, this will make them different URLs in every aspect; especially if you consider them Open Graph objects – likes for these different URLs will not accumulate, but be counted for each URL.
Apart from that, maybe posting a link over and over again is not even the right mechanism for what you are trying to achieve – maybe you’d be better of by defining some real Open Graph actions, and using those to publish your “scores” for your users on Facebook …?

Facebook Timeline App, with custom content

I would like to know if the only way, in which we can display things in the facebook timeline is by pushing those to facebook. Is there a way in which the items to be displayed could be queried just right before displaying the aggregation.
As an example, let's assume I want to post suggestions for recipes in the timeline of the user. Is the only way to do this, to post an open graph action to facebook, or is there some way, in which facebook could ask my website what the suggested recipes are:
Timeline of a fb user is opened
Request to my site is sent for the suggested recipes
my site responds with a json object
suggestions: [
{name: "Risotto", img: ..., link: ...},
{name: "Pasta", img: ..., link: ...},
...
]
The above information is displayed in the facebook timeline
I'm not really sure what you're trying to accomplish here. Timeline Apps and related custom Open Graph actions and objects are to be used to accurately and honestly describe actions that the user (whose Timeline it is) has taken in apps. So, taking your recipe idea, the app involved should only publish stories similar to these:
Recipes suggestions created by the user
The users favourite recipes
The users favourite ingredients
You can see here how this relates specifically to things that the user has done. This means that it is not reasonable that the content of the Timeline posts should change.

Facebook Application Send Friend request using Facebook Api

I want to send Facebook friend invitations to some of our friends list without using FBML tags (<fb:request ....)
I am writing code in ASP.NET using fbServices.
How can I send friend requests without using FMBL tags?
Friend requests cannot be done through the Facebook API. The FBML fb:request-form tag is the only way to do this.
I spent a great deal of time looking, and finally came accross a very simple solution.
Using the Facebook Javascript API you can do a friend request with:
<script>
FB.ui(
{
method: 'friends.add',
id: fbid // assuming you set this variable previously...
},
function(param){
console.log(param);
// If they cancel params will show:
// {action:false, ...}
// and if they send the friend request it'll have:
// {action:true, ...}
// and if they closed the pop-up window then:
// param is undefined
}
);
</script>
The callback script can then simply performs an ajax call to your server where
you save info about the action, if needed.
You can test this by using the javascript console app on Facebook:
http://developers.facebook.com/tools/console
Paste in the script above, including the tags, or click the "Examples"
button on the bottom of the text area and find the "fb.ui — friends.add" example.
fb:request-form is now obsolete and will be deprecated eventually. The new way, announced on 27 January 2011, is the Requests Dialog.
Facebook does not allow you to programatically send friend requests.
I suggest taking a look at their API
Okay. Years later, things has changed:
https://developers.facebook.com/docs/reference/dialogs/
Dialogs provide a simple, consistent interface to provide social
functionality to your users. Dialogs do not require any additional
permissions because they require user interaction. Dialogs can be used
by your application in every context: within a Canvas Page, in a Page
Tab, in a website or mobile web app, and within native iOS and native
Android applications.
There are currently 7 Dialogs available for you to use:
- The Feed Dialog allows a user to post a story to their Timeline and to their friends' News Feeds
- The OAuth Dialog allows a user to authorize an application as part of an authentication flow.
- The Add Page Tab Dialog allows a user to add an application to a Facebook Page which they administer.
- The Friends Dialog allows a user to send a friend request to another user.
- The Pay Dialog allows a user to make a purchase using Facebook Credits.
- The Requests Dialog allows a user to send a request to one or more of their friends
- The Send Dialog allows a user to send a Facebook Message to one or more of their friends.
See also: https://developers.facebook.com/docs/requests/
You can send requests to friends without using FBML as follows
`FB.ui({
method: 'apprequests',
message: 'This is my applicaiton',
title: 'Application Request without FBML',
filters: 'all'
},
// Callback function returning the list of requestObj Ids
function(response){
}
);`
For more info you could refer
Wiki Page for apprequest graph API