Podio API integration for customer task management
Podio is a fantastic tool for managing your work and projects. Basically it’s a database, like Sql or NoSql … But with a rather fine user interface (UI) on the top. You can create Apps (tables), in these, you can create cards (rows) and you can reference databases and rows to each other (reference tables). It’s intirely up to you which types of data and how many, you put into your cards (rows). And that makes it very flexible.
So Podio is a flexible database … And you can use the data from that database in your backend code – using PHP or Ruby. THAT GAVES A LOT OF OPPORTUNITIES!
Imagine that you can now let your employees use a very simple database, and that is what Podio is – but for your customers, you can decide exactly what the customer should see and whey they should not. Plus you can easily make customers interact with the database.
This gives your workflow a whole new set of agility, that e-mail cannot offer.
## TO BE CONTINUED ##
Getting started
Get the PHP library here: http://podio.github.io/podio-php/
Great links for getting started:
Create your API key here: https://developers.podio.com/
Podio API documentation: https://developers.podio.com/doc
Great tutorials from the API documentation: https://developers.podio.com/examples/items
Fields to use and the explanation: http://podio.github.io/podio-php/fields/
For creating show/hide trigger: http://jsfiddle.net/QYjLY/
My code:
Creates a complete repporting system for customers. You can use it and alter as you want, but please leave a backlink to me if you do.
<?php header('Content-Type: text/html; charset=utf-8'); require_once 'podio-php-4.3.0/PodioAPI.php'; $client_id = "xxxxx"; $client_secret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; $app_id = "xxxxxxxxxx"; $app_token = "xxxxxxxxxxxxxxxxxxxxxxxxxx"; //ACCESS PODIO: Podio::setup($client_id, $client_secret); Podio::authenticate_with_app($app_id, $app_token); ?> <style> .beskrivelse { text-align: left; width: 600px; margin: 16px auto; border: solid; padding: 10px; } </style> <script src="http://code.jquery.com/jquery-1.6.4.js"></script> <?php $q = $_GET[q]; $opgavestillerName = base64_decode($q); $opgavestiller = preg_match_all("/[\._a-zA-Z0-9-]+@[\._a-zA-Z0-9-]+/i", $opgavestillerName, $matches); $opgavestiller = implode('', $matches[0]); //Turns ARRAY into a string $opgavestiller = str_replace(["<", ">", ""], "", $opgavestiller); if($q == "") { echo "<h1>Du har valgt en invalid bruger</h1>"; } else { ?> <div style="margin: 70px 0 0 0;"> <h1 style="text-align: center;">WEB-Projekter i gang nu for <?php echo $opgavestillerName; ?> </h1> <table border="0" align="center" cellspacing="0" cellpadding="10" width="900" style="text-align:left;"> <tr style="background-color: grey;"> <th>Status</th> <th>Navn</th> <th>Kategori</th> <th>Deadline</th> <th>Ansvarlig</th> <th>Beskrivelse</th> </tr> <?php $query = PodioSearchResult::app( $app_id, $attributes = array('query' => "$opgavestiller")); // SEARCH FOR that name recieves from query pram $q $i = 1; foreach ($query as $key=>$value) { $json = $value->as_json(); $json = json_decode($json, true); $item_id = $json['id']; // I GANG?? $item = PodioItem::get($item_id); foreach ($item->fields['kategori']->values as $option) { $status = $option['text']; } if($status == "I gang" || $status == "Ikke pƄbegyndt") { if ($i % 2 == 1) { $bgcolor = "#afffff"; } else { $bgcolor="#e0ffff"; } // Determines the bg-color of the table if ($status=="I gang") $ststusCol="#ffd954"; // Status color elseif ($status=="Ikke pƄbegyndt") $ststusCol="#f77983"; echo "<tr style='background-color:$bgcolor;'> <th style='background-color:$ststusCol;'>$status</th>"; // TITEL $titel = $item->fields['titel']->values; echo "<th>". $titel . "</th>"; // CATEGORY $kat = $item->fields['kategori-2']->values; if($kat != "") { echo "<th>"; foreach ($item->fields['kategori-2']->values as $option) { echo $option['text'] . "<br>"; } echo "</th>"; } else { echo "<th></th>"; } // DEADLINE $deadline = $item->fields['deadline']->start_date; if($deadline != "") { echo "<th>" . date_format($deadline, 'd. M Y') . "</th>"; } else { echo "<th></th>"; } // PERSON IN CHARGE $collection = $item->fields['opgaveansvarlig']->values; if($collection != "") { echo "<th>"; foreach ($collection as $contact) { echo $contact->name . "<br>"; } echo "</th>"; } else { echo "<th></th>"; } // DESCRIPTION ?> <th> <div id="eventTitles"> <a href="#" id="growlab" rel="#<?php echo $i; ?>">Vis beskrivelse</a> </div> <div id="eventDescriptions"> <div id="<?php echo $i; ?>" class="beskrivelse"> <?php $beskrivelse = $item->fields['beskrivelse']->values; echo $beskrivelse; ?> <p><a href="#growlab" class="close" style="margin-left: 50%;">Close</a></p> </div> </div> </th> <?php echo "</tr>\n"; $i++; } } } ?> </table> </div> <script> $(document).ready(function() { $('#eventDescriptions>div').hide(); $('#eventTitles a').click(function() { var target = $(this).attr("rel"); $(target).show('slow'); }); $('#eventDescriptions a.close').click(function() { $(this).parent().parent().hide('slow'); }) }); </script>