Is it possible to enforce initial configuration of a page app? - facebook

I'm attempting to develop my first Facebook app that is designed to allow clients of our website to sell tickets to their events from their Facebook page as well as from our website. So when the administrator of a Facebook page adds our app as a page tab, I need to be able to find out who they are so I can load the relevant event data. There also needs to be additional include/exclude configurations and various other options, which will affect the behaviour of the app.
So my question is how is this situation best handled? When playing around with a basic sandboxed app, I seem to be able to just add the app directly to a page; there is no prompt for configuration, and I can't see any way of defining custom properties.
Is the 'edit_url' property the only way to achieve this? If so, is there a way of automatically directing the page admin to this link upon initial use?

Decoding the signed request recieved in your page will give you more insight.
From this you can retrieve page admins' UID's.
You'll need to manage the rest on your side...
In order to get the user id the user will have to grant your application basic permissions.

I'm currently doing a somewhat similar app and, just like Lix said, I used the signed_request variable to detect the page where the tab is installed. Then, based on the page's ID, I retrieve the proper content.
To also give your users an admin page, add a Page Tab Edit URL in your app configuration where you can redirect your users to a custom panel where they can edit their app.

Related

Test multiple apps on facebook

I freelance now and I am wanting to set up a Facebook account so I can create multiple apps for different clients under this account, then become admin and roll out the app totheir page.
Does anyone else do this and if so how best is it to set up from the outset as I will need to test without the public seeing etc.
Yes - I do this frequently...
Placing your application in sandbox_mode will ensure that only the people who are allowed to see the application have access to it.
You can also add your applications to your own un-published Facebook page, that way no one will be able to search for your page or application either.
A mixture of sandbox_mode and an un-published page should be the safe way to go. Check out the Application Security page in Facebook's documentation for exact explanations of sandbox_mode and the roles you can give users in your application.

Easiest way to create a Facebook application

I need to create a simple tab page with custom content inside. How on earth I can get there the shortest and easiest way? Maybe I want to track the users who liked the page, but that's not compulsory. I just want to create a tab-page, which can integrate into a page and shows some custom content.
I have created an application at Facebook, the thing is, I don't know where to head from here, to include some content in the innards of that page...
I guess you want a static FBML tab. It is hard to find on Facebook, however it is possible to find a link like this. If you are logged in to Facebook then it should take you to a page where you can add a static FBML tab to one of the pages you administer. After that you can customize the tab content from page settings.
A page tab or any application on facebook can be and usualy is considered a normal website. You'll need the same things that you would if you wanted to create a website. You'll need a server, some storage space, possible a database (if you want to store date about/for your users).
There are ways to get started for free - lots of free hosting companies out there. You can start your search here
Facebook also has links to [develop applications in a cloud system].
There are different types of facebook apps, but one of them is just a canevas app.
So you ca include an external web page in a facebook page. It's pretty similar to a frame i think.
You can find inforations here: https://developers.facebook.com/docs/guides/canvas/#canvas

How to register a Facebook Application dynamically via Graph API like wildfireapp and others doing?

I am trying to create a sweepstakes application.
I am trying to copy wildfire.
But I am unable to create facebook applications dynamically like they are doing.
I checked it they are using graph api to show on front end but there is no method available in graph api to create applications dynamically.
Can anyone please guide me how wildfire is doing dynamic app creation. Is there any alternative available?
In general, they are likely not creating new applications for each client. Unless you can show us evidence of this, it is the same application being installed many times onto their client's Facebook Pages.
The application script can detect the Page ID and change the display logic appropriately. Seen here:
Get Facebook fan page ID
If you really want to create applications for your clients, take a look at this thread:
http://facebook.stackoverflow.com/questions/6264080/create-a-facebook-application-programmatically
EDIT (Not being able to comment is horrible) in response to J's post:
There is not a way to create applications entirely programmatically, but you can get really close creating a user-flow around:
https://www.facebook.com/connect/create_app.php?api_key=[key]&name=app_name
Where [key] is the api_key of the parent application. It isn't documented anywhere so you should have a manual fall back in place. The link above does work to create a new Facebook application tied to the currently logged in user (the parent api_key does not seem to have any effect but it is required).
To determine the api_key of the application created, ask the user for the appropriate permission and query /accounts to retrieve a list of Facebook applications the user owns. Do this before and after the user clicks the above link to determine which one was just created. From there, have the user get a new access_token and get the appropriate permissions to modify application settings. You should then customize the newly created application.
Mike
This has been mentioned several times in the old Facebook forum.
Wildfire, North Social et al, do not create applications dynamically. It's the same application being installed by many clients.
How is this possible? Well, when a Page loads a tab application, Facebook pass you a signed_request parameter. When you decode this signed request with your application's id and secret, you will find inside the page id from where the tab application is being called. You can then use this to work out which of your clients is making the call to your code and therefore what content to deliver to the browser.
There have been changes to the Graph API recently to allow you to manage applications once created but you cannot (and likely will never be able to) create applications programmatically through the Graph API.
The second thread mentioned by Mike mentions child applications but this was deprecated from the Facebook code base some time ago and would not actually allow the creation of applications in the way I assume you want.
J

.NET Web Forms multiple product subscriptions under one account?

Background:
I am working on a legacy ASP.NET 3.5 Web Forms applications. The application allows users to buy a subscription to a 'white-label' website which is generated for them and they can customize it further. It uses forms authentication.
A typical use-case is that the user creates an account on our system, purchases a website, and then proceeds to customize their website. The URL they will use to edit their purchased website is something like this: https://www.example.com/EditWebsite.aspx. There are many other pages also within our website editing toolbox with other URLs.
Problem:
My team has now been tasked with allowing people to use one account to access multiple website subscriptions. This means that one authenticated user could be trying to access one of many websites to edit if they use the URL mentioned above. Our system can be made aware of multiple subscriptionIds per User but the website editor web app only has support for one subscription.
To clarify with a simpler example: this would be like if Google all of a sudden allowed you to view two different inboxes with one GMail account. How would the system know which one you were trying to access if the URLs were the same for both?
We originally wanted to change the application to use URLs like: https://www.example.com/[subID]/EditWebsite.aspx which would give us all the information we need to send the user to the correct website. We looked into URL Routing to accomplish this but it seems that we would have to change all of the web app's internal links to use the route config to generate the correct URLs. Maybe we have the wrong idea here but it seems like too much work for a legacy application.
Another potential solution we came up with was simply using our systems' control panel web app (where they click links to edit any of their websites) to set a session cookie which our edit website web app can read to know which website to bring up. This has the disadvantage that the pages would not be bookmark-able and you could not look at multiple websites at once in different tabs of the same browser.
Question(s):
Is there any other options we have not investigated or thought of? Is there any other web sites which allow for this kind of behavior; how do they handle it? Is URL Routing the right way to do this and we just need to take the plunge?
Any input is appreciated!
The solution we ended up using was adding a URL parameter to the link which specifies which website you are trying to edit.
https://www.example.com/EditWebsite.aspx?subID=123
This parameter is included in the links to 'Edit Website' from the page which lists all of a user's websites.
When present, this sets a session cookie for the user. If the request parameter is not present, the app looks for the cookie being set; this handles all the internal links within the application. if a cookie doesn't exist and the request parameter was not set, we just pick the authenticated user's first subscription from the list.
This isn't perfect but it has worked without issue so far. The only consequence it has caused is that a user cannot edit multiple websites in the same browser session, e.g. using multiple tabs. This hasn't resulted in any support issues yet though so it is pretty much a non-issue.

How do I create a Facebook application for use only on page tabs?

I'm currently creating a very basic Facebook application and I've run into a bit of a roadblock, so any help would be appreciated.
My application is as follows: I want to have the application pull records from my database that the user has added to my site off of Facebook and display them in a tab on one of their fan pages. Everything the user could add or edit will be done on my site (not on/through Facebook) so all I need to do is have my application check which page is requesting and display their records. I imagine the install will go something like this: user signs up on my site, user adds app to their page, user links their account and fan page (thinking of the best way to do this), user adds records.
The problem I'm running into is there's barely any information on the new Facebook PHP-SDK (does not use the require_login() method) and I'm not really sure how to start. Again, the only functionality I need on the Facebook end is for them to be able to add my application to their fan page and be able to distinguish between which page is requesting my app.
Does anyone have any resources for creating a basic application with the new SDK? Facebook's dev section is absolutely no help for beginners and I'm pulling my hair out despite a pretty solid grounding in backend development.
Thanks!
tab apps have some limitations comparing to regular fb apps. You can read about those here.
How to make a tab - register a facebook app, fill out "Tab Name" and "Tab URL" fields in the profiles settings (you might need to fill out "canvas" settings first).
Now all tabs will be loaded from "Tab URL" on your server. How to find out who is tab owner - check for fb_sig_profile_user request parameter in your tab page handler, which contains owner's user id.
This should get you started.