Pushing Podio

Fun Experiments pushing Citrix Podio to the limit so you can get more done.
... with a little help from GlobiFlow, ProcFu, and other friends ...

How to add Any Podio View to Google Calendar

- Posted in Uncategorized by

I often need to publish some arbitrary view from Podio to my Google Calendar. The use-cases are many, but often revolve around synching free/busy times etc.

Although you can export a Podio Calendar, you cannot export any arbitrary Podio View ... until now.

ProcFu Website Widgets to the rescue again :-)

The Setup

Let's say you have an App in Podio that has a date field (configured to show times and end dates), as well as some other fields.

The first step is to create a View in Podio that will show only the future events, and only the fields we're interested in:

Here the view is called "Future" and only shows items one year into the future and only the title and date time range.

The Code Block

Then, we need a ProcFu code block to get this view and generate the ICS equivalent of the data:


// IMPORTANT : set your Podio timezone date_default_timezone_set("America/Toronto"); // Get the simplified view from Podio $view = json_decode(call_pf_script("podio_view_get.pf", ["app_id" => 17471712, "view_id" => 38172856, "raw" => 0]),true); // now build the ical feed $eol = "\r\n"; $ical = "BEGIN:VCALENDAR" . $eol; $ical .= "VERSION:2.0" . $eol; $ical .= "PRODID:-//procfu/ical1//NONSGML v1.0//EN" . $eol; foreach ( $view as $item_id => $event ) { // date is formatted as "yyyy-mm-dd hh:ii:ss - yyyy-mm-dd hh:ii:ss" $parts = explode(" - ", $event["date-time-range"]); $begin = $parts[0]; if ( sizeof($parts) > 1 ) $end = $parts[1]; else $end = $begin; $ical .= "BEGIN:VEVENT" . $eol; $ical .= "UID:" . $item_id . "@procfu" . $eol; $ical .= "DTSTAMP:" . gmdate('Ymd').'T'. gmdate('His') . "Z" . $eol; $ical .= "DTSTART:" . gmdate('Ymd', strtotime($begin)).'T'. gmdate('His', strtotime($begin)) . $eol; $ical .= "DTEND:" . gmdate('Ymd', strtotime($end)).'T'. gmdate('His', strtotime($end)) . $eol; $ical .= "SUMMARY:" . $event['title'] . $eol; $ical .= "END:VEVENT" . $eol; } $ical .= "END:VCALENDAR" . $eol; // Set correct content-type-header header('Content-type: text/calendar; charset=utf-8'); header('Content-Disposition: inline; filename=calendar.ics'); return $ical;

Make sure to put your own timezone in the code, and your relevant app and view ID's.

Website Widget

Now we create a Website Widget on the Account page in ProcFu to serve the result of this code block:

Here I'm setting the cache life to 600 seconds (10 minutes). You should set it to an appropriate level for your use-case. Too low, and you will use up unneccessary action in your PF account to run this code block each time, and too high you will get too much lag in refreshing of the data in your calendar.

To get the URL of the widget, click on the help link:

Google Calendar

Now we just need to add this URL to Google Calendar.

Click on "Add a friend's calendar"

Select "From URL", and enter the URL:

Then click on "ADD CALENDAR", and voila:

Comments