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

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.

Related

One Facebook app multiple users

I'm thinking of a facebook app that fetches a website's content (already developed with my own web builder) and display in a custom facebook fan page format. Clients already using the Web builder will only have to add the App to their fan page and they have their website's content already plugged into facebook.
The problem I'm having is knowing how exactly to automate this process. I can't seem to find the "Add app to page" menu when you click the Gear Icon, and the link below gives an approach I can't be explaining to every client (video further down in the link)
http://onlinewealthpartner.com/add-facebook-application-fan-page/
My head might swirling from everything I've read so far, but I'm just easing into the facebook app development. Help/insight would be much appreciated.
If I understand, your central problem is to make it as user-friendly as possible for your users to add your app to their fan pages?
Bottom line is they would need to visit the link mentioned in your tutorial:
https://www.facebook.com/dialog/pagetab?app_id=YOUR_APP_ID&display=popup&next=YOUR_URL
However, since you're the one creating the Facebook Tab Application, then you would already have and could supply to your users the "app_id" and "next" parameters, so all they would need to do is click on the custom link you provide. You could even give them a button in your web builder. Your users would just click a button, go to this link, and pick their fan page in a drop down menu.

How to get App ID for an existing facebook page?

I have the following case:
My client already has a facebook page with timeline and a decent amount of likes.
My job is to integrate facebook comments and facebook like to their website. For this I need an App ID, which I can easily get by creating a new app on developers.facebook.com
What I want is to somehow connect this app to the client's page so;
it shows up on their insights report
maybe likes and interactions get connected to the client's page instead of an app
I have already spent many hours trying to get this to work, but I don't yet see a way.
I can imagine that when I create a new App and then add a page to that app I have them connected. Though my client's company isn't an "app", it's a real-world business. Also, this way my clients loses all their likes on their current page.
Please help me figuring out the right way to do this.
Thanks in advance.
If you have a Pretty URL, you can go to http://graph.facebook.com/{yourpagename}. The App ID of the page will be right there at the top. If you do NOT have a Pretty URL for the page, the App ID of the page is the number at the very end of its URL.
There's no way to link an existing app and page (by 'link' i mean mark the page as being the page which represents that app) - you can of course install an app on to your page as a tab, or use an app to manage the page and post updates, etc, the documentation for both of which is on the main developer site
Login to your page >> Click on Settings > Click on Apps from left panel > Select your page app >> Go to the bottom
Here you can find User ID

Displaying iframe content on a facebook page from a custom url

I am trying to create a system which allows customers to add a Facebook page as an add-on to what our business offers. Ideally I want users to click a button from our site which creates a page for them on Facebook which contains an iFrame in which content is served by us from our site.
I've never done any work with Facebook before, I don't really understand how the whole app thing works (I don't really use it personally as well) and I'm not sure what the best way to achieve what we seek. I have read a few tutorials on the fb developer site, which were all completely out of date, but I created an app of type 'App on Facebook' that displays a canvas url with an iframe which displays some content.
However, what I really want is to do one of the following:
1) Create an app that can be added to someone's page, which takes a custom url and displays this url in the iframe on the canvas page.
For example, a user called bob initialises the facebook integration from our site, we automatically create a page for them, add the app we have created, and provide a url like http://ourcustomurl.com/bob which is a link to some content from our site which is then displayed in the iframe.
2) Another option I thought would be possible would be creating a new app for every user who enables the facebook integration from our site, and just setting the canvas url on creation. But this option doesn't sit well with me, we don't really want to create an app for people, but a page.
You can't create a Facebook Page or an App via the API
If i understand correctly you want page admins to install your app into a tab on their page, and have different content displayed on that page tab depending on which page it is.
Check this document: https://developers.facebook.com/docs/appsonfacebook/pagetabs/
The main takeaway you should have is that you can use the signed_request which is sent to your app to determine which Facebook Page the App is being loaded from and decide on your side which content to display based on that

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

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.

Facebook app - no "Installable to"

I am creating a small Facebook application for pages (not profiles).
I can see in many tutorials, to allow the application to be added to a page, as a tab, you need to select in the app settings:
Authentification -> Authentification Settings -> Installable to : Facebook pages.
I think the menu is evolving since different tutorials show different locations.
Form the screenshots, I can tell this page is for me Facebook Integration.
In it I can see the Page Tabs section, but there is no "Installable to" option.
Not here nor anywhere else.
That really drives me crazy, I have wasted almost half day on this, I just want to click this option ... :(
If anyone can tip me on this my appreciation will be infinite!
Thank you,
Aurelien
That option is no longer exists (at least in the settings page).
What you can do is getting the page admin to authorize your application and then post on his behalf OR get the page access token (also needs the admin authorization) by asking for the manage_pages permission.
A quick note when reading tutorials about facebook development, check the date of the article because most of articles are outdated!
I found out how to add my app to a new tab:
You need to create a profile for the page admin! If you didn't, on the top right of Facebook page you should have a link 'Create Your Profile'. It doesn't make sense to me but ...
Go to this link (thanks ifaour):https://www.facebook.com/dialog/oauth?client_id=YOUR_APP_ID&redirect_uri=YOUR_URL&scope=manage_pages&response_type=token
Got to your http://www.facebook.com/apps/application.php?id=YOUR_APP_ID and add the app to your page