Facebook Connect + Coldfusion Using the Graph API

by Michael Santoroski on September 2, 2011

The new graphapi makes getting Facebook connect super easy, but putting all the pieces together is a little tough.

What you need to do is set-up the Facebook connect button, and let it save the cookies for you. From there you can get an access token, required to get information back from the API. You can use cfhttp calls and get JSON back.

Step one is to follow Facebook’s instructions to get the Javascript set-up for the Facebook Connect button, found here:

https://developers.facebook.com/docs/guides/web/#login

Note: You need to request the permissions that you want in the button HTML, for example ours looks like this:

<fb:login-button perms="email, user_education_history, friends_education_history, publish_stream, offline_access">

Once this is done, you can use some ColdFusion to read the cookie and get the accesstoken.

<cfset left = Find("access_token=",cookie.fbs_239625941285)+13>
  <cfset right = Find("&",cookie.fbs_239625941285,left+1)>

<cfset accessToken = Mid(cookie.fbs_239625941285,left,right-left)>

<cfoutput>Access Token = #accessToken#</cfoutput>

And to get the Facebook ID:


cfset left = Find("&uid=",cookie.fbs_239625941285)+5>
  <cfset len = len(cookie.fbs_239625941285)-left>

<cfset SESSION.FBID = mid(cookie.fbs_239625941285,left,len)>

<br><cfoutput>Facebook ID = #SESSION.FBID#</cfoutput>

The next thing is to use the Graph Explorer tool to find the syntax for what you want to pull:

https://developers.facebook.com/tools/explorer

For example to get e-mail we use the code:


<cfdump var="#cookie#">
  <cfhttp url="https://graph.facebook.com/100000929135466/?#accessToken#" method="get" /> 

        <cfset response = DeserializeJSON(cfhttp.filecontent) />

<cfoutput>

<p>email = #response.email#</p>

</cfoutput>

You can try an example here:

Example

And I have uploaded the CFM files here:

http://webapps.roanoke.edu/michael/fbconnect/facebookconnect.zip

Let me know if you have questions or comments!

{ 1 comment }

Drop Dead Simple SMS Notifications with Twilio

by Michael Santoroski on July 15, 2011

I have been working to replace our internal SMS notification system with one that was not dependent on our servers, power and applications being up.

I found Twilio a while ago, but never had time to play with the service. Long story short, we finally got things up and running this week, and it really is awesome.

I put our our code on a Dreamhost account we have for our WordPress blogs. Basically we wanted anyone on the IT Staff to be able to send a text message and have that message rebroadcast to the whole IT Staff, so we could all be aware of developing situations and problems. So, even if network or power is out on the whole campus, we can send a message.

The Twilio tutorials gave us exactly what we needed, and pricing is a very affordable 1¢ per message, you pay $1 a month for a phone number.

We also, added a password protected page that had a web form that our students assistants could use to notify staff.

I am looking at where else we can utilize Twilio for other services campus, and replacing some of our other higher cost SMS services. (We currently let users sign up for text messages reminders of calendar events and students get SMS reminders for course evaluations.)

Drop me any questions in the comments sections. Also, I would love to hear if you have used Twilio or another service and what your experience has been.

{ 0 comments }

New Features of Our Mobile Site–Coming Soon

April 28, 2011

We are working on add a new (third) row of icons to our mobile home site. Right now they are: Admissions Alumni Majors Awards But, of course this is subject to change. Check out some screen shots below, and hit up the comments link with your feedback. Admissions: Alumni: Majors: Awards:

Read the full article →

Fat Footer is Live

April 12, 2011

Our new Fat Footer went live yesterday afternoon. Check it out at http://www.roanoke.edu. I think it is a huge improvement, and has several features that I have wanted to implement for long time.

Read the full article →

Blog Upgrade

April 9, 2011

Just a quick note to let you know we have upgraded our blog to use Dreamhost’s VPS (Virtual Private Server) service. So far seems to be running much better.

Read the full article →

Video Responses to Facebook questions

April 5, 2011

Roanoke has several Facebook groups for prospective students and a very active group for accepted students.  We have current students help answer questions in these groups.  Lately, there have been lots of questions and my intern was spending lots of time writing lengthy replies. So, we decided to do video responses to their questions.  We [...]

Read the full article →

Roanoke is #22 on Top Social Media Colleges list

April 4, 2011

Roanoke College was named to the Top 100 Social Media Colleges list, published by Student Advisor.  We were ranked #22 to be exact and were the only school from Virginia in the top 25. We are in good company with Duke at #18, Brown at #20, Yale at #24 and Dartmouth at #25. Their comments [...]

Read the full article →

Fat Footer Moves Forward

March 29, 2011

I recently talked about doing a Fat Footer on our website. We got the comps back from New City and they look great! Also, I got the XML working for the Google Analytics “Popular Today” feature. I used the GA CFC from RIA Forge by Pete Alexandrou, and it worked perfect. I was able to [...]

Read the full article →

Fat Footer

March 4, 2011

We are looking at adding a fat footer to roanoke.edu My plan is to add the following content: About the college section, (this is something that I have wanted to add for years) Full address, and links to maps, directions and mobile Admissions phone, e-mail and top links “Popular Today” links from our Google analytics [...]

Read the full article →

Xitracs For Reaccreditation (SACS)

March 1, 2011

Roanoke recently moved our accreditation compliance report out of our internal CMS and over into Concord USA’s Xitracs Accreditation Management System. Their system is cloud based, and handles all the perilous requirements of the compliance audit report that we needed. Notable features include: Roles based management Flexible output options (zip, pdf, website, single file website). [...]

Read the full article →