Facebook "Like" to see canvas page - facebook

Ive seen this on a lot of facebook sites. I was wondering how to setup a welcome page and when the person likes that certain page they are then able to see more information about the page.
ie: http://www.facebook.com/BacardiLimon under the welcome tab.
thanks!
Also a related facebook question. Does anyone know how the slide show at the bottom is created in fbml?

<fb:fbml version="1.1">
<fb:visible-to-connection>
Welcome, fans!
blah blah blah...
<fb:else>
NONFANS
</fb:else>
</fb:visible-to-connection>
</fb:fbml>
who knew it was that easy :P

Now that iframes are the only way to create new Facebook apps and FBML is being phased out, you need a new way to do it.
When your app URL is loaded, it is passed a signed_request POST parameter. This parameter contains the information you need. However, it is packed and encoded so it requires some manipulation to get the right info out.
First, split the signed_request on the '.' character. The first part is the signature. The second part is the encoded_data
Decode the encoded_data into a JSON string using the URLBase64Decode function equivalent in your server-side programming language
The JSON object contains a node called "page". This contains a node called "liked".
If "liked" is true, the user liked the page and you display the "liked" version of your app. If false, show the "Please like me" version of the site.

Related

Facebook Like button inside Delphi program

I would like to add a Facebook Like button inside my software.
I know how to programmatically do the actual liking process,
but how do I check and see if a person actually has liked my page?
Edit: I'm guessing that my software also has got to communicate with an actual Facebook App
that I have to develop, and not Only with a regular facebook html source?
Have you considered dropping a TWebControl on your Delphi form, assigning a simple HTML document string to it that contains the markup needed for a Facebook like button and making it just large enough to display your facebook like button content?
The like count and user liked state would be handled automatically by the javascript dynamically loaded into the html page. The javascript written by Facebook.
Seems like a full-functionality, least-effort approach worth considering.
I don't have Facebook to test this, but try to use what is described in this blog post; try to use the following HTTP GET request and in the response (after you parse it), find the user you're looking for:
https://graph.facebook.com/me/likes/PAGE_ID&access_token=ACCESS_TOKEN
Where PAGE_ID should be your page ID and ACCESS_TOKEN your access token.
For a simple GET request you can use e.g. this code.

How to prevent others from using my facebook application?

I just created a Facebook application that basically creates a new Tab on my Facebook-profile-page and loads contents from my website in an inline frame. Now I got to the point that I added the application to my profile page with a simple link like http://facebook.com/add.php?api_key=APP_ID&pages=1. But how can I prevent others from just doing the same and using my app on their pages then?
Thanks in advance!
Aha! You know the page that it is supposed to belong to, so hard code that in your app's code and you can check the page id coming in from the signed_request and see if that page id is yours. If not, send down not permitted in your response HTML. If it is your page, then response down the good HTML. :)
For more information on signed_request see: https://developers.facebook.com/docs/authentication/signed_request/

How to like / share URLs inside Facebook that contain get-parameters

We are working on a facebook-app with lots of dynamic pages. As the app is embedded in a tab on a facebook page, the urls contain a get-parameter to address the correct tab/app. We want to implement like- and send-buttons for several pages within our app, but facebook seems to dump all get-parameters from urls within facebook. As the result all like- and send-buttons point to the facebook-page itself instead of the tab.
Does anybody now any workaround? We already tried redirects via an external sefor facebook urls only.rver but facebook seems to evaluate the links on click of the like-/send-button (and seems to follow all sort of redirects).
UPDATE:
Here is an example of a problematic url:
https://www.facebook.com/smartmobil.de?sk=app_171502639574871
UPDATE:
The problem seems to be independant of url get-parameters. It seems that the like-button does not work with any url starting with www.facebook.com
When used in a like-button everything behind the ? will be dumped. This seems to happen for facebook urls only.
Best workaround so far is to point your like buttons at external (non-facebook canvas) urls.
To make this work, you need to do some conditional redirecting to get the user back into your canvas URL. You can either use a client side javascript redirect:
<script>
window.location = 'http://apps.facebook.com/yourcanvasname/foo/bar';
</script>
Or you can do a server side redirect based on the useragent string. Basically, if the useragent contains 'facebookexternalhit' then render a basic HTML page containing OG tags, if not, redirect to the canvas URL.
Doing this means the Facebook sharescraper/linter won't follow any redirects back to the canvas URL, but any user that arrives at your URL will get back to Canvas.
i'm too searching for a solution to control the custom page tab's content through a get parameter (app_data). I still don't have a solution but here at least the reason why all www.facebook.com links are srtiped out of get params. Here at bottom the developer explains why.
Unfortunately I don't think what you are trying to do is possible. Posting a like programmatically requires you to specify a Facebook content ID or alias. This won't work for you because tabs to not seem to have an exposed content ID of their own, and instead use the Page's content ID with an additional parameter which you can't use with the graph.
Liking external links and other content that does not have an ID programmatically is prohibited. With an external URL, the first like of an unrecognised URL creates a new Facebook page for those likes to be represented on (which is the issue I've given up trying to fight), but presumably the presence of your Page's content ID alias (www.facebook.com/smartmobil.de) in the url is making Facebook choose you page rather than creating a new one.
The only suggestion I can think of this late at night is to target an external URL that performs a redirect via Javascript, rather than on the server, but Facebook may be wise to that too and I'm afraid I'm going to bed rather than testing it :)

How to create a Facebook App with "Like it" confirmation?

i'm a totally newbie in Facebook App coding and i would like to creat a simple app that give the main content only after a "Like it" confirmation?
The example:
http://www.facebook.com/RelapseRecords?ref=ts&sk=app_162097493835692
(You only see the download links after "Like it")
Where i can find a how-to for that?
Thanks in advise, reevex
Actually, it is possible. Facebook recently introduced the „Signed Request” parameter which can be used to obtain what you need. After you decode this parameter you will have a JSON object. One of its field is called page. This is another JSON object containing among other params the liked boolean if the user has liked the page. This is only available if your app is an iframe loaded in a Page tab.
Based on this boolean value you can choose which content to display to the user.
Good luck!

facebook landing page

i have one problem with facebook landing page. i created facebook landing page through static fbml app but i have one problem with like button, user must like the page before he will navigate to another page.
i want to do same functionality in my landing page,
http://www.facebook.com/BusinessofCinema?v=app_6009294086.
anyone know about this please help me .
thanks inadvance......
At this point you'll probably want to go with iframe based Facebook page tabs instead, now that these have become available and fbml based apps are being phased out. Among other advantages, the signed_request parameter that Facebook sends to an iframe based tab app includes a flag that indicates whether the user is a fan of the page.
Now that iframes are the only way to create new Facebook apps and FBML is being phased out, you need a new way to do it.
When your app URL is loaded, it is passed a signed_request POST parameter. This parameter contains the information you need. However, it is packed and encoded so it requires some manipulation to get the right info out.
First, split the signed_request on the '.' character. The first part is the signature. The second part is the encoded_data
Decode the encoded_data into a JSON string using the URLBase64Decode function equivalent in your server-side programming language
The JSON object contains a node called "page". This contains a node called "liked".
If "liked" is true, the user liked the page and you display the "liked" version of your app. If false, show the "Please like me" version of the site.
The FBML way will continue to work the way you have it live right now, but for anyone building a new Facebook app, this is the way to do.