Note: This page documents the old setup. The current setup is similar, but is written in perl, calls the twitter API directly, and fetches events out of the website calendar database. Due to changes in the calendar software used on the website, this solution will need to be re-engineered once new website calendar software is selected (changes in free options have removed iCal feed support from the free version of the website calendar software).
CCHS-Twitcal is the twitter to google calendar integration setup that as developed to tweet event reminders for CCHS.
The CCHS-Twitcal shell script posts an event to the @HackMelbourne twitter feed prior to an event. The tweet contains an appropriate header, the date/time of the event, the title of the event from the calendar, and an appropriate footer. The script is run out of cron regularly so that any updates or changes get tweeted without manual intervention.
CCHS-Twitcal follows the following steps:
This basic process is followed twice. Once to check for events coming up soon (ie: event is about to start), and once to check for events in the futher future.
CCHS-Twitcal requires the following:
If an event has gone out to twitter, and you want to cancel it, I recommend doing the following:
If an event has gone out to twitter, and you want to change it, I recommend doing the following:
Note: Of course, you could just tweet changes manually in either case. However, if you don't have direct access to the twitter account and the script is scheduled to run regularly (eg: every 30-60 mins), the above should work, as long as you have access to the Google calendar to change it.
The script is fairly parametrised, so that everything is pretty much variables at the top. This should allow someone to modify/reuse the script for a different group/calendar/etc easily. It's also very well documented. I've removed the old version of the script from this page as it has changed quite a bit from the version previously posted. If you update the script, please make sure to keep the documentation within the script up to date (including incrementing the version number).
gcalcli cannot read a calendar anonymously, which means you MUST have a google account to access the calendar. This IMO is sub-optimal, but I haven't found any other tool that could be used to access the calendar from a script easily. Also, gcalcli ties us to Google calendar, instead of something like using ical, which would allow usage of other calendar systems (eg: Event calendars implemented in Wordpress).
As we only tweet the nearest event(s), this means that if there are two events that follow one another, only once the first event starts will the new event be available for tweeting. This is by design, so that we don't confuse, but if you have a lot of events, it may be worth reconsidering how best to communicate these events to your twitter followers.