Aim
- Always have up-to-date Facebook events, which I’m attending to, in my calendar (I use Google Calendar)
- Additionally sync to other calendar-related services, like Doodle
- Use LAMP server to update (import-export) calendar
This is a draft. Research phase.
Existing solutions
Standard Facebook events export
- webcal: URL is provided by Facebook for all upcoming events. URL is compatible with Google Calendar.
- There were problems with events, which description did contain special (national) characters. Generated iCalendar data was invalid and unreadable by Google Calendar (all events weren’t available)
- It is not possible to filter events in any way. All events, even declined ones, are listed.
Facebook Freedom
- Possibility to select (filter) events by attending status. For example hide all declined and tentative
- Permanent URL expires and must be recreated regularly
- Uses third party server
To implement
- Use Facebook Graph API
- Download list of upcoming (all?) events
- Convert to iCal (whatever compatible to Google Calendar) format
- Place as static file (with permanent URL) on my running Apache server
- Add the calendar file URL to Google Calendar
- Script (automate) steps above for updating the file
- Read events
- Convert
- Update static file
- Schedule the script via cron
- PROFIT!
Framework comparison for converter
bash
- Input: curl
- A framework (functions library) for parsing JSON Facebook Graph format is required (implement from scratch?)
- Output: echo to text file
- A framework (functions library) to support iCalendar format required (implement from scratch?)
- There may be problems with text encoding (charset)
Java
- Input: Existing Facebook API frameworks
- Output: iCal4j
Security
- Calendar data must be only accessible for authorized (trusted) clients: me, Google Calendar
- Data should be requested over an encrypted channel (HTTPS) to prevent “man in the middle” attack
- It seems to be no way to hide URL from proxy in the middle, however the proxy must be normally trusted service.
- Clarified:
- Google Calendar supports custom CA certificates when reading calendar data over HTTPS. It is possible to add test iCalendar data from https URL on the test server.
- When using a “secret” URL for the static file on Apache server, make sure, that automatic directory index generation (directory listing) is switched off (at least within a folder with the file). Otherwise it will be possible to browse all available files and find out the exact data URL. See configuration example below:
<Directory /usr/local/apache2/htdocs/dontlistme> Options -Indexes </Directory>