CL-Facebook

Because the REPL beats web interfaces any day.


News

Feb. 4 cl-facebook now depends on drakma instead of the unmaintained cl-trivial-https. If anyone is using cl-facebook, let me know so I can list projects using it here!

Apr. 27: New updates including session-saving code, link-posting, and access to most of the events API.

Apr. 3: SVN repository now online! Upated to use facebook's new 1.0 API and preliminary automating of login/permission-getting through launching browsers to the correct windows. Hopefully, event information to come.

Download the source

Get the source from svn:

svn co svn://common-lisp.net/project/cl-facebook/svn
WebSVN: here

cl-facebook requires cl-ppcre, md5, drakma, and cl-json to work.

Mailing list

Post problems, inquiries, patches to the cl-facebook-devel mailing list. Most development discussion goes on through the mailing list.

Example

(require 'cl-facebook) 

;; These values will be specific to your application

(setq *api-key* [your api key])
(setq *secret* [your secret app id])
(setq *auth-id* (cl-facebook:facebook-auth-id *api-key* *secret*))

;; Facebook requires the user to log in through their site for desktoop apps
;;   This opens a browser to the right uri with xdg-open

(cl-facebook:facebook-login *api-key* *auth-id*)

;; Establish a session, the session holds onto important info

(setq *session* (cl-facebook:establish-facebook-session *api-key* *secret* *auth-id*))

;; Get the logged-in user's notifications

(cl-facebook:get-notifications *session*)

((:MESSAGES (:UNREAD . 3) (:MOST_RECENT . 1238768017))
 (:POKES (:UNREAD . 1) (:MOST_RECENT . 1238728053))
 (:SHARES (:UNREAD . 0) (:MOST_RECENT . 0)) (:FREIND_REQUESTS) (:GROUP_INVITES)
 (:EVENT_INVITES 91210025411))

(cl-facebook:events-by-eids *session* `(,(cdr (assoc :evnt_invites n))))

(((:EID . 91210025411) (:NAME . "The Lady's Not For Burning")
  (:TAGLINE . "A hypothetical Devil brought into conversation with a witch")
  (:NID . 0)
  (:PIC
   . "http://profile.ak.facebook.com/object3/1898/95/s91210025411_8784.jpg")
  (:PIC_BIG
   . "http://profile.ak.facebook.com/object3/1898/95/n91210025411_8784.jpg")
  (:PIC_SMALL
   . "http://profile.ak.facebook.com/object3/1898/95/t91210025411_8784.jpg")
  (:HOST . "The Lady's Not For Burning")
  (:DESCRIPTION
   . "A in a poetic comedy by Christopher Fry, directed by Kate McConnell.

Thomas Mendip, a discharged soldier weary of the world and eager to leave it, comes to a small town, declares he is a murderer, and demands to be hung by the town's officials.

General admission, $5; students FREE.
For tickets or information, call 228-7641. 

SHOW DATES:
Friday, April 10th at 8pm -- Opening Night
Saturday, April 11th at 2pm and 8pm 
Sunday, April 12th at 2pm
Monday, April 13th at 8pm
Tuesday, April 14th at 8pm -- Closing Night

CAST:
Ela Dugan ('12)
Alexander Korman ('09)
Michael Needel ('09)
Lyndsay Werking ('09)
Garrett Gish ('09)
Cooper Sivara ('11)
Allie Geiger ('09)
Robert Eaton ('11)
Kelly McKay ('09)
Lauren Harries ('11)
Jacob Stein ('09)")
  (:EVENT_TYPE . "Music/Arts") (:EVENT_SUBTYPE . "Performance")
  (:START_TIME . "1239418800") (:END_TIME . "1239773400")
  (:CREATOR . 46884998556) (:UPDATE_TIME . "1238642189")
  (:LOCATION . "Brehmer Theater (Dana Arts Center)")
  (:VENUE (:STREET . "13 Oak Drive") (:CITY . "Hamilton") (:STATE . "New York")
   (:COUNTRY . "United States") (:LATITUDE . 42.8269) (:LONGITUDE . -75.545))
  (:PRIVACY . "OPEN") (:HIDE_GUEST_LIST)))

To set the status:
(let* ((api-key "....")
       (secret "..."))
   (sleep 2)
      (let ((auth-id (cl-facebook:facebook-auth-id api-key secret)))
           (cl-facebook:facebook-login api-key auth-id)
	        (sleep 2)
		     (let ((session (cl-facebook:establish-facebook-session api-key secret auth-id)))
		            (cl-facebook:facebook-set-status session "is now 'upstream' for cl-faceboook"))))
T

cl-facebook is released under the BSD-license.