Dynamically linking to a Facebook Company Page - facebook

Our database has an entry for our companies' Facebook and Twitter pages. With Twitter, it's possible to create dynamic links based solely on the company's Twitter handler. For instance, if the company provides us with the Twitter handle acme, we can dynamically create a link to their Twitter page with <a href='http://www.twitter.com/#{company.twitter_name}'></a>.
In some instances, the same is true of Facebook. Coca Cola for instance has http://www.facebook.com/cocacola. Many other companies have a url that looks more like http://www.facebook.com/pages/acme/123456789. In the latter case, the numerical id at the end is necessary to reach the page. The URL http://www.facebook.com/pages/acme would not work.
My question is, is there a way to dynamically link to a Facebook company page with just their handle? Or do you always need to provide a full URL? I'm hoping Facebook has some magic back door for developers that I simply haven't happened upon yet. Thanks for your feedback, one way or the other!

A link in the form http(s)://facebook.com/profile.php?id={nummeric_id_here} always works, for pages as well as for user profiles.
It automatically redirects to the “real” address – to the username that the user or page might have set, or to an address in the form you mentioned (for pages that do not have enough likes yet to set their own user name).

Related

Maintaining continuity of a Facebook post from website to Facebook

I am building a social application, users post data to the website, which is saved in our database.
This creates a record on the site, which is searchable and creates the basic content and function of the site (the purpose is not relevant at this point)
When a record is saved to our database, I want to "spread the word" and send this data out to social networks. Currently, I'm looking at Facebook in isolation.
So, I know how to create a post through the Graph API and post this content to the users Timeline, or indeed to a business page associated with the APP/Website.. but I am not sure how, or if indeed one should, maintain continuity.
What I mean... if a user creates a record on my website, and then the website/App creates a post on my business page, and also asks the user to post it in their Timeline, how do I stop this being two separate posts, and instead one post which has been shared?
I want to achieve:
User posts on website
>
Website posts to Page
>
Post on Page is "Shared" to users Timeline
As opposed to:
User posts on website
>
Website posts to Page
>
Website posts an additional post to users Timeline
The reason I want to do this, is that on the website, I want to be able to show shares, likes and comments from Facebook by tracking the ID of the initial post created when first entered onto my website.
Or am I trying to reinvent the wheel and should just use Facebook's comment plugin?
When you create the post on facebook on the Page, store the returned post ID in your data model.
From what I can tell, there is no way to access the normal user share directly through the API. If you insist on doing it programmatically without popping up any dialog for your user, you can make a post to the user's page which has (the start of) the Page post and a linkback to the Page post as an attachment. This is probably to prevent abuse.
However, if you don't mind relying on an undocumented and deprecated endpoint, you can use the old sharer.php endpoint, so long as you have a fully qualified link to the post you want to share (you can retrieve the url through the api). This will also require your user to enter anything appropriate in their share and then click "share."
The endpoint is
http://www.facebook.com/sharer.php
Call it with the u parameter filled in with the url, so
http://www.facebook.com/sharer.php?u=[URL encoded URL of the post you wanted to call]
You can try this with any facebook post (go to a post, copy the url, past in as the parameter), it's still working (I just tried it) but there are no guarantees. See the top answer to Facebook API: "Share" a post already posted on a page's wall?.
You can still access likes, comments, etc for that post id through the Graph API (and you can provide your users a direct link to the post). Cache/update them as recommended and display them on your own page. You are basically mirroring back onto your own site what is happening on facebook in regards to the post you made.
I would go this route especially if you are at all planning on branching into other services. That way you can do an aggregated display of statistics/likes/etc from the multiple services you are having your platform repost to. This is also good for (at least an impression of) data integrity for your users: they know that your service represents everything they have done in case anything happens to their facebook/etc accounts.
This could especially be noteworthy if they are worried about facebook/etc deleting any of their posts, or for recovering from any issues where a post/comment/etc is not properly stored by facebook/etc (for example, comments have a maximum length which, at least via the main FB UI, silently drops anything above the maximum length in a non recoverable way for the user).

Is this possible to require website visitor to fan a facebook page to access content on the website?

I was wonder if this would be possible and how to do it. I have a personal website. I wanted to have it so that in order for the visitor to gain access to a specific page,the website checks to see if that visitor is a fan of our page on facebook. If they are not, they must become one to advance to the page content on my website. I thought perhaps there is a code that would do this? Maybe some kind of token/cookie combo? Any help would be great. Iv been searching for a solution to this. The page on my personal site gets a lot of traffic so I want to require all visitors to that page to become a facebook fan and the site verifies this before letting them into the page.
Outside of Facebook you can only check if a user likes your page if you have the user login to your site first.
So you’d need to set up an app, have the user login, ask for their permission to read their likes, read the info if they like your particular page – and then either let them see the content, or present them with a like button.
How it’s done in detail is all in the docs – so please have a look around there if you think it’s worth the cost.

'Normal' Pages / App Profile Pages / Website Graph Page & Likes

When setting up pages on Facebook, there seems to end up 3 pages.
A Page that represents the website, i.e., when someone Likes the website, they like a newly created Facebook page that represents this website.
A Page that represents the brand, this is a true Facebook page, as created by the user.
An Application Profile Page, which is created by the user because the website in (1) allows endusers to login using their account.
Pressing Like on the website does not +1 the like count on the brand page in (2) above, likewise, liking the brand page doesn't update the count shown on the like button on the website either.
The App posts updates to users profile, with a link back to the App Profile Page, although it has the same functionality as the brand page, is empty as the brand page is the one being maintained.
You can't choose a username for the app profile page, nor change its category, nor 'use' facebook as this page, nor 'check in' to a profile page, nor set any other information like address/phone number; so you wouldn't want to use the profile page as the brand page as it's missing these features.
To clarify, the Graph API contains 3 objects that essentially represent the same thing, their types are as follows:
type = "page"; representing the brand
type = "website"; representing the website of the brand
type = "application"; representing the ability for the website to login via Facebook
Each of these Graph objects collects their own Likes.
How can the likes be collected under a single identity? Why can't a single Graph object/page have all the features that each type of page above has to offer..?
So, a few thoughts:
The Open Graph tries to represent the world as a collection of Objects, with Types. A Facebook Page is one type. A website is another. You might have a Facebook Page, but not a website. Or a website, but not a Facebook Page. An Application is something completely different too (although it's confusing, since they DO give Applications profile Pages...). Lots of folks with websites and applications don't use a single App.
So they do not always represent the same thing, which is why they are not the same thing.
But sometimes they do, sort of, represent the same thing (as in your case).
When this happens there are a couple tricks you can do to improve brand coherence on Facebook.
1) On your website, point the link button to your Facebook Page
<div class="fb-like" data-href="http://facebook.com/mypageurl"></div>
This way at least you have a slightly more unified Like count. You can't hide/disable Page likes, so the best you can do is try to funnel website likes to Page likes. Users will see your Page Like count on the website, and when they like your website your Page count will increase.
2) Have a link on your App profile page to your regular Facebook Page
If you are using an App to publish things, there is that small tagline at the bottom of the post that links to the app. Some folks will click on it. Just add a link to your description in the sidebar saying "Visit our page here!". If there is nothing going on with your App page except a link to your real Page, I don't think you will collect too many Likes on the App page.
(I think you could also set up a custom landing tab on your App page that redirects users to your Facebook Page if you want to get real fancy. It used to work, at least, not sure if it still does.)
EDIT: 12/9/2011 Facebook is removing App Profile pages:
http://developers.facebook.com/blog/post/611/
It's all kind of a pain, I know. Perhaps worth filing a bug about? But there is a reason why things are the way they are, I don't think you have to worry about the App page all that much, and there are some ways to mitigate the problem.
Good luck!

Problem with like it button and public permissions

I'm a web developer and i'm having problems using the "like it" button
I put the buttom on my site as a counter of votes of a special contest. People can only click the like buttom if they are fan of my Facebook page.
The problem is that people can't vote if they haven't public permissions on his facebook, cause i can't know if they are or not fans of my page.
Is there a solution?
if you rely on information that you are not certain that you can obtain then sadly there is no solution.
Since what you are doing is beyond a simple like button What you may want to try is open a facebook application and request from your users the user_likes permission. You can read more about it here. I have photo albums on the "highest privacy setting" - only me. Yet when I request a list of my photo albums through one of my applications (with the required permissions of course) I get back ALL of my albums.. This might have been a temporary issue that was solved - but in any case - I saw this behavior and I thought it might be relevant to this post :)
Additionally you should look at the Promotions Guidelines specifically this point :
You must not use Facebook features or functionality as a promotion’s registration or entry mechanism. For example, the act of liking a Page or checking in to a Place cannot automatically register or enter a promotion participant.
I had some problems with facebook on this issue - you are not allowed to require someone to "like" a page in order to participate in an activity that is not directly connected to that page.
From what I understand you are requireing people to like your page on facebook beofore voting on your site... If this IS the case then facebook might very well start taking action and closing your page/app.

Facebook page apps - Authorizing a user

I can't seem to find exactly what I'm looking for. We're trying to build an app to run solely on a Facebook Page. We want to show a landing page if they don't Like the page, and the contest entry form if they do. This functionality works.
Before showing the contest entry form, we'd like to authenticate the user viewing the app so that they can just hit "Enter the contest!" and we can automatically pull a name/email address.
Any of the methods of authentication I've seen described, including through the Facebook Developer docs, don't work at all.
I saw something that said they need to interact with the app first, then you can get the id, but that doesn't work either. I also don't get the page id passed with the signed request.
Its also pretty unclear whether I should be using an iframe or just FBML.
Could anyone point me in the right direction, please? Thanks!
You need to create a fan page and add the FBML plugin to that page, then you will need to insert a short code that will determine if a facebook user has clicked 'Like' or not and by determining that you will decide weather to display the content of the landing page or not (using an iframe). You will probably like to also set the FBML box that you create as the default view for members who didn't press the 'Like' button yet, you can change the default view in your fan page settings.
On the iframe, you will need to use the Facebook API if you want to retrieve any user information from Facebook, for that, you will need to register a new application with Facebook. Go to developers.facebook.com for the API integration and app registration.
Also, what do you mean when you say:
Any of the methods of authentication
I've seen described, including through
the Facebook Developer docs, don't
work at all.
Well, it appears you can't do it that way. The client was very specific in wanting that functionality but we ended up convincing them to go for a redirect to the canvas page to have the app authorized and the contest entered instead.