I'm working on a game using Facebook, but not hosted by Facebook. One of the things I would like to do is to invite other people via Facebook to play a game. I've found the invite API, that looks something like this:
FB.ui({method: 'apprequests',
message: 'Some message goes here',
},
function(response){
// Do stuff here
}
);
Ideally I would like clicking on the link from that invitation to go to my web site, but there doesn't seem to be a way to do that. Am I missing something completely, or does this just not seem to do what I think it should at all?
Related
So, I've created a wedding event on my FB account. Now on my website (static) I would like to have a form (maybe embedded or something from FB) that a visitor could leave a message on it for greetings. That message would instantly post on the event I have created.
I hope you understand what I would like to achieve.
Is it now possible to do that? Or Is there an API for this? comment mirroring seems not applicable for events.
If it's not possible to achieve, is there an alternative that is easy to integrate on my site and of course the message will post on FB.
There are tons of APIs for Facebook, all listed on the Facebook developers documentation page: https://developers.facebook.com/docs/
But I think what you're looking for is something like this:
https://developers.facebook.com/docs/javascript/examples
Trigger a Share dialog
The Share Dialog allows someone using a page to post a link to their timeline, or create an Open Graph story. Dialogs displayed using the JavaScript SDK are automatically formatted for the context in which they are loaded - mobile web, or desktop web.
Let's make an API call to publish a message. Add the code into the response function of the FB.login call you added above:
FB.login(function(){
// Note: The call will only work if you accept the permission request
FB.api('/me/feed', 'post', {message: 'Hello, world!'});
}, {scope: 'publish_actions'});
Try the script. A status message will be posted to your timeline: Hello, world!
This code worked well in many Facebook apps on mobile devices:
FB.ui({
method: 'apprequests',
message: 'some message'
}, function(response){
console.log(response);
});
But not anymore. The dialog opens up, but its not loading friendslist to send the apprequest.
No errors, no changes from my side. Seems like Facebook dropped some kind of mobile support?
This sounds like the following bug report: https://developers.facebook.com/bugs/1483731408567352/
Can you confirm that it is the same? If so, please subscribe to that bug report to stay posted.
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 am primarly ASP.NET(HTML,Js) programmer and I don't know anything about Fb apps. Recently I stumbled on a problem. I have web application that generates image buttons and generates code as HTML or Iframe for user to post on different websites, however as far as I know: It is not possible for user to embbed Iframe or post image wrapped with link to friends wall?
So before I start researching how to do anything on Facebook and go on wild goose chase, I just wanted to check with fellow programmers that might have experiences with this kind of stuff is it even possible to do this on Facebook?
If it is possible, can you give me some hints how the process goes or point me to some articles?
Any help is appreciated, thanks!
No, it is not possible to post iframes to a user's wall.
To be more specific, to post to a wall, we use Feed dialogs (with FB.ui), You can derive what you can and can't do from the list of parameters that FB.ui gets (scroll to "properties" in the feed dialog doc)
To show the "post to wall" dialog, you need to do something like this:
FB.ui({
method: 'feed',
link: "link",
picture: "picture",
name: "name",
caption: "caption",
description: "description"
}, callback);