I spent yesterday evening grappling with getting events from a Facebook group to display and automatically update on a Joomla website. Sounds simple, and it ought to be, but there are the usual load of gotchas and quirks lurking in there.

What the client needed was two things - a module on the home page giving a list of forthcoming events, and a calendar as the main component on a dedicated page. No requirement to edit events on the website, just simply reflect events that are created in a Facebook group.

OK, first thought - there ought to be a module to do this so over to JED to have a trawl around. Needless to say this is a no money project so it has to be a free download component and module, preferably without any intrusive backlinks or copyright notices. The site has been built on Joomla 3 so the extension has to be compatible with that.

After much searching and trying out one or two promising sounding things I came to the conclusion that there isn't a simple existing solution that does what I need. One thing I don't want to have to do is create a Facebook 'app' to get an app id and secret key which is what most solutions using the official Facebook API seem to require. Apart from anything else I am not the owner of the Facebook Group.

It is possible to export Facebook events from a personal profile to ical - and on investigation it turns out that this provides a webcal:// link which can be polled to update an external calendar from Facebook. This only works from events in a personal profile though - but no matter, we could simply create a new Facebook ID make sure it has no friends but join it to the group then any events in the group calendar will appear as invites in the profile calendar and these can be included in the export. Of course anything else that is in the calendar for the profile you use will also get exported which is why it might be worth creating a 'clean skin' account.

In your profile home page click on "Events" near the top of the left hand column, then in the next to right hand column near the bottom under "Birthdays This Week" and "Events For You" is a small panel explaining that you can add your events to Outlook or Google Calendar with a link titled "Upcoming Events" [blooming americanized bastardisation of language] - right (or Cmd) click on this and "Copy Link Location" - this will give you a link like webcal://www.facebook.com/ical/u.php?uid=100001234567890&key=ABC1DEfgh3IJKlMn

Whilst you are on Facebook you also need to check the settings on your view of the events for the group you want to reflect. Go to the Events tab for the group and click on the little cog-wheel next to the Create Event button. Select settings and in the pop-up adjust as you wish. You will probably want to make sure that "Hide invites from iCal export" is NOT checked - that way anything that is posted as an event in the Group calendar will turn up as an invite in your calendar and get included in the export.

So now to see if we can find an existing extension which allows import from an external webcal:// url. Turns out that the old tried and tested JEvents extension will do exactly this. It provides both a Latest Events module to show forthcoming events in a module position and also a full calendar with various views - as well as a lot of other bells and whistles.The basic system is free - yipee.

Install it in Joomla and in the JEvents Control Panel under Manage Calendars click to create on the Default calendar to edit it. Give it a name etc and select the "Create from URL" option. Paste in the webcal URL that you got from Facebook and select "Allow Anonymous Refresh". Save and exit back to the list of calendars. (If you wish you can leave the default calendar empty and create a new one instead. If you do this you can use the default one to add events locally on the website - although they won't be sync'd back to Facebook). There will be a red blob underneath "Anon Refresh" in the list of calendars. Click on the blob to enable Anon refresh and you will get a 'URL' linkwhich you can copy and use to run a job that automatically updates the import periodically.

You can also manually update at any time by clicking the green squiggle uder "Update" in the calendar list next to the calendar you are using.

OK now we have imported the current events from Facebook we need to arrange for automatic updates. The best way to do this is through a Cron job. If you have CPanel access to your web host server then you may find that you can easily create cron jobs there - this is nice and simple and allows you to preselect commonly used settings as well as manually edit. You can also have the output of the job sent to an email address (although you wont want to do this if you are running it every 5 minutes.

If you don't have access to create a Cron job on the server then a workaround is to create a hidden module on one of the pages on your site that is frequently visited but doesn't include the full calendar component and have that module run the URL that you got as the update URL from the JEvents setup. This way every time a visitor loads the chosen page (perhaps your home page) the update will run.