Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Outside access to Facebook events

Let's say I own/control a Facebook page where events are posted. I'd like to display these events on another website (In my case, a WordPress blog, but that's not the important part) on an "Upcoming events" page.

What I'm unsure about is: Is the Facebook API usable "externally" like this? I've downloaded the PHP library and have a demo app running that works from within Facebook (i.e. emitting FBML that facebook.com interprets and displays to the logged-in user), but in my case I want a third party (my web server) to query Facebook every so often, rather than the site visitors directly requesting data (HTML/JSON/etc.) from Facebook itself.

Is this sort of thing possible with the Facebook API? How will my web server authenticate itself? What information do I have to store?

Note: I'm looking for information more at a "sequence diagram" conceptual level, not just asking for code. That part I can figure out myself. ;) Unfortunately, Google and the FB developer wiki have not been entirely forthcoming. What do I need to know so I can start coding?

like image 640
Brant Bobby Avatar asked Aug 27 '09 01:08

Brant Bobby


People also ask

Can you share Facebook events with people not on Facebook?

Tap the event, then tap Invite. To invite friends who don't have a Facebook account, enter their email addresses or phone numbers and tap the boxes to the right. Keep in mind standard messaging rates apply.

How do I invite people that are not my friends to a Facebook event?

If you are not Facebook friends with someone, but you want to invite her to your event, you must have her personal email address. Although the invitation will be delivered through traditional email and not a Facebook notification, your friend can still see details about the event and RSVP.

How do I find Facebook events not near me?

In the top left corner, you can tap the city name to browse events somewhere else.


2 Answers

This is a basic overview of how I've done it for a few of my clients who wanted similar functionality:

  1. Create a pretty basic app that prompts for Extended permissions, specifically "offline_access" and whatever else you need
  2. Store the resulting Session Key in your database with the UID
  3. Create a secure, authenticated webservice for your app which allows you to get the info you need for a UID that you supply, using the session that you've stored in your database
  4. On the website make requests to your app's webservice, being sure to cache the results for a certain period of time and only make a new request to your webservice once the cache has expired (I use 5-10 minutes for most of mine)

So basically your Facebook app acts sort of like a proxy between the website and the user, doing all of the authenticating and requesting using legitimate means.

I've used a webservice because I only wanted to maintain one Facebook app for multiple client's needs. It works like this (in a not-very-awesome ASCII art diagram):

Facebook User 1 \                    / Client Website 1
Facebook User 2  --- Facebook App ---  Client Website 2
Facebook User 3 /                    \ Client Website 3

Note: I've only done this for users, not pages, so your mileage may vary.

like image 92
Jason Berry Avatar answered Sep 29 '22 00:09

Jason Berry


You can do Events.get with the Facebook API then supply the page/profile ID you'd like to get the events for. Depending on how your page is setup you may have to authenticate, simply use your Facebook account, since you should have access to all the events. oh and make sure you do plenty of caching so your not hitting Facebook on every page load.

like image 26
Tom Avatar answered Sep 29 '22 01:09

Tom