Creating Facebook App - facebook

Im new to facebook applications. I recently created a webapp that consisted of html & php. But recently Ive decided that integrating my webapp within facebook would be useful. Any tips on where to start? Ive looked over developers.facebook.com and im confused. It appears they are in the process of updating. Ive come across a few guides but there from a few years ago. This app will run completely within facebook and im probably gonna have to rewrite all the code. Any guides or suggestions?
Thanks!

You didn't specify the programming language you're using but if you're developing asp, start by looking into Facebook c# sdk here: http://facebooksdk.codeplex.com/
If you're using any other language (i.e. php), try looking into respective software dev. kits (i.e. facebook php sdk). They will facilitate your job in comparison to starting raw development all by yourself.

Tim, if you want to get into the business of working with Facebook, you need to know right away that they are always in the process of updating. That being said, you should learn some Facebook terminology so you can do more research and figure out what you want to do.
Applications that run within the Facebook interface are called Canvas Apps. Your application is hosted on your own server, and Facebook simply adds an iframe in their UI that points to your app's URL.
Another way to go to create a webapp that uses your own design, but still utilizes a single sign-on system from Facebook. This used to be called a Connect App but now they don't really have a name for it. Basically, you can use Facebook's authorization system to pull Facebook user data into your own database, which basically eliminates the need for a registration page. The authorization system prompts the user to allow your app to get specific data about them - once they authorize it, your app has access to do whatever the user gave it permission to do.
The best document to wrap your brain around is about authentication: http://developers.facebook.com/docs/authentication/
Give that a whirl, and good luck!

Related

Determining kind of facebook app

https://apps.facebook.com/horoscopes/?fb_source=search
Can anyone tell me what kind of facebook app it is? canvas or something else?
I would want to create an app in php but have no clue where to start from. Can i create a test app and start the process? please help.
I have tried creating an app but that needs to be approved before even starting the development and showing us as a page on facebook app
Any app with an address of apps.facebook.com/* is the Canvas link to the App, which means this app has a canvas page at the minimum. It may also have a website and mobile app associated with it, but that's harder to determine.
You should so some research before trying to create an app. You do not need to get any sort of approval to develop an application, even if you use excessive permissions. However, you will need to get your app approved for any extra permissions prior to launching to end-users.
You should visit the Facebook Developer website and pick a SDK you're comfortable with. I would recommend using the JavaScript one to get started, but the choice is yours. Then you should follow the starter guide to creating your first app. Everything you need to create an app is discoverable through Google, and I have a few handy tutorials on my site for using the PHP and JavaScript SDKs.

Where to begin with using Facebook's PHP SDK to create events?

I want to use Facebook's PHP SDK to create/update/cancel events on our Facebook Page, whenever they are added/modified/deleted within the "calendar of events" database table on our web site.
Where do I even begin with this? I have the SDK installed, but I am having a really hard time figuring out how to register my own custom app and install it to my Facebook user account. I did manage to get an App ID and App Secret, and I also created a minimal canvas and indicated which persmissions the app needs. But, for the life of me I can't figure out how to install the app on my FB user account.
I don't want to make the app available to others, and I don't even want to access it while I'm logged into Facebook. I just want to be able to do something like $fbapi->createEvent() within my own code on my own site.
Also, do I need to have an authenticated Facebook user session/cookie when calling the API to create the event? It seems to me that would eliminate the possibility of creating events via a command-line PHP cron job.
I feel like I am understanding bits and pieces of this, but there are gaps in my understanding and I'm not seeing how all the pieces fit together. Any direction would be immensely appreciated!
First play around with the Graph API Explorer https://developers.facebook.com/tools/explorer so you can understand better how the Graph is used. From there you can then learn about the PHP SDK http://developers.facebook.com/docs/reference/php and how to do the same things you did with the explorer tool. Events are here documented here: http://developers.facebook.com/docs/reference/api/event/

Canvas app using the FaceBook 3.1 API?

I used to develop a few FB apps in the past (using the old rest-ased api), and now I'm considering to make them actually usable again by porting them to the new 3.1 API.
Sounds nice, but for some reason this is way harder than I should be...
So here are few questions:
Is there any example of a canvas app using the 3.1 API? Google did not give me anything useful
Is there still a difference between iframe and FMBL canvas applications? In my app settings, I checked the fmbl-option, but when I'm back at the app overview page, it still says it's an iframe app.
The SDK mentions the getUser() function to get the user-id, but how do I request the necessary permissions for my app? When I do some googling, I find even another solution which calls a specific url and then performs a callback. This solution however doesn't seem to php sdk at all!
Where is the documentation of the php-api? The only usable thing I find is this: https://github.com/facebook/php-sdk which consists only a few lines of code. And I suspect this is for having a fb login-button on your own website, not for a canvas app.
Firstly, good luck, and best wishes - you'll need it. Maintaining Facebook apps is way harder than it should be, because Facebook doesn't believe in legacy support, changes things all the time, and deprecates things quickly and completely. As a (former) Facebook app dev myself, I can tell you there is only one constant: apps will die if you leave them alone. As an app developer, Facebook owes you no favors, and it is vicious when it comes to breaking apps.
As for specifics: as of June 2012, Facebook has deprecated and removed FBML and the REST API, and there is no longer any difference between canvas apps and iFrame apps. This isn't a soft, "you shouldn't use it" deprecation - it's a hard, "your apps are now broken" deprecation. All apps are now iFrame apps, as there is no longer any other way to build them. The docs on how to build a canvas/iFrame app are here, and there's an auth migration guide that may be helpful in conversion. Oh, and you'll need to get your app running on HTTPS too, if you haven't already.
As for the rest of it, it sucks, but the only way you're really going to be able to maintain and get your application working is using the Open Graph API. Using the PHP SDK, you just run $facebook->api('/graph/url/here') - for instance, to get user information, run $facebook->api("/$userid"). You get the URLs off of the Open Graph docs - just grab everything after the graph.facebook.com bit and pass it to api(). It's another learning curve, and (depending on the complexity/modularity of your code) is anywhere from a lot to a nightmarish mountain of changes, and there are no drop-in replacements. Sometimes you can use the old REST api, but I doubt that will last very much longer either. It's painful, but that's how it goes. You're at the mercy of Facebook, because it's their data.
Upgrading apps involves a shift in thinking: apps are now literally just webpages surrounded by the Facebook chrome. There is now no difference between an external website that uses Facebook's api to pull in information and an app that runs inside of Facebook. It's for that reason, personally, that I've shifted to just that for my own app - an external website that just happens to use Facebook for most of its posting/sharing/user info needs.
For authorization, you request permissions via OAuth, using any number of methods. There are docs on how to do that over on Facebook as well. Specifically for the PHP api, you generate a URL using getLoginURL() and then redirect to it. Facebook eventually redirects back to a URL you specify with info about whether they authorized your app and such, after which you can do a getUser(). If you want fancy/slick/user-friendly popup dialogs without a bunch of redirecting, the Javascript SDK is your friend.

How to integrate app with facebook?

I made a quiz app using wordpress using a quiz plugin so that, the work could be done easily. I do not have any knowledge about how to integrate that app that I've made with facebook. Right now I've just kept the app on my localhost.
Do I need to add some API's or something like that? I have not handled AJAX and all that before but I do have knowledge about php.
I think you should clarify a bit about how do you want your app integrate with Facebook:
1) You want your quiz application as an on-Facebook canvas page application (which seems to be the case here):
Register an application on Facebook. The guide here is fairly easy to follow.
Read the basics about canvas Facebook
Learn about OAuth 2.0 authentication with Facebook. This step is optional since there is a good PHP library for Facebook. But I think it will saves you time afterwards.
Use PHP SDK for Facebook.
2) You want to use your own website, just add "login with Facebook" function (to record high scores, for example):
You should check Facebook integration for website. It's not too different from the first case.
I just give you the starting place. If there's something that is not clear enough, feel free to drop a more detailed comment.

How to get facebook data from app?

I'm writing a sort of visualization desktop (non-web) application, just for fun.
However, ideally I'd want it to be able to pull information from the user's facebook account. (after getting its credentials, of course)
What's the best way to do this? Should I register a new 'facebook app' even though I'm not really making it web-based? I've never written a facebook app before.
I'm using Java as my prog language, btw.
Thanks!
Yes. Facebook supports desktop applications, but they must go through a special authentication mechanism. Essentially, the user will need to be directed to facebook through a web browser window as part of the authentication process.
Here is the documentation on the authentication process: http://wiki.developers.facebook.com/index.php/Login_Desktop_App
There is a relatively polished Java library for facebook here: http://code.google.com/p/facebook-java-api/
If the Java library above does not meets your needs, you can build an implementation on your own. Essentially, you will need to interact with the Facebook REST server, as described at the top of the page here: http://wiki.developers.facebook.com/index.php/API
Edit: After doing some more research I have a few more resources to provide:
Here is a list of some applications written using Java for facebook:
http://wiki.developers.facebook.com/index.php/Facebook_apps_written_in_Java
And there's even a neat desktop application that is open source here:
http://code.google.com/p/fb-photo-uploader/
Good luck!