If OpenPaaS then Todoist

David DOLCIMASCOLO
Linagora Engineering
4 min readMay 10, 2017

From May 3 to May 5 we at Linagora had a barcamp (a team building session where we all work in the same cool place on a single topic) focused on integration and documentation. One of the objectives we chose was to bootstrap the integration of OpenPaaS with IFTTT, a platform where you can connect services you use together to create interactions (if THIS then THAT), and one of the use case we defined was to gain access to Todoist, a popular online task management service.

Here’s what we achieved !

Day 1, exploring the possibilities

We started by reading IFTTT’s excellent documentation on building a service (a service is a product that you can connect to other products, like Twitter or Facebook for instance) for OpenPaaS. We found out that it was pretty straightforward, providing that your product supports OAuth2 workflows for authorizing external applications and that you can implement REST APIs. Luckily enough, OpenPaaS has all of this :)

IFTTT’s endpoint testing tool

We also got a nice surprise when we noticed IFTTT is giving you a tool to deeply test your API endpoints in order to see if you did a good job at following their documentation. This allows you to be confident and incrementally move forward in your code, checking for non-regression at each step.

A similar tool also exists to validate OAuth2 workflows in order to make sure users can link their account with your service.

We then moved on to triggers (if something happens in your service, then do something in another service) and actions (if something happens in another service, then do something in your service) before finding out what an applet was. No, it’s not some Java bytecode running inside a browser, it’s a connection between a trigger and an action. Services provide some pre-built applets that users can simply enable (“if I recommend a story on Medium, then Tweet that”); and users can also create custom applets by manually linking a trigger from one service to an action of another service.

Day 2, integrating with Todoist

Before starting required implementations to integrate OpenPaaS with Todoist we coded a few other actions and triggers, but these are not part of this story :) Follow Linagora Engineering on Medium to read more about this barcamp.

Our objective with Todoist was to track events created inside the OpenPaaS calendar with a specific #Hashtag in either the title or the description of the event and automatically create tasks in Todoist for these events. The use case is to get a reminder for slides you might have to prepare for the meeting, or to check the traffic around the meeting location before taking your car. To accomplish this we needed:

  • A trigger firing when a new event with the chosen hashtag is created, and thus, a way to query events containing a hashtag in our database
  • A binding to IFTTT’s realtime API, to… well… be realtime !

The trigger implementation turned out to be easy. We simply query our indexing engine, Elasticsearch, for events matching a hashtag in the logged-in user’s calendars. Of course, we already had indexing of events in place so this was pretty easy to do. The only thing we needed to add was to index the timestamp at which events are created or modified, because IFTTT needs this information as well to track resources returned by your trigger. After validating the implementation using the endpoint testing tool we were ready to move on to the realtime stuff.

OpenPaaS already supports realtime interactions through the use of a message broker, RabbitMQ, to send notifications between various internal components. And guess what? Created or modified events already trigger a notification :) We then only had to listen on the correct topic to get notified when a new event is created in the user’s calendars to send a HTTP POST request to IFTTT’s realtime API. In reaction, IFTTT immediately queries your trigger endpoint.

Easy-peasy.

Day 3, more cool stuff please!

Once we had the basic interactions in place, we could iterate to add more features. For instance, we create tasks in Todoist with a dedicated OpenPaaS label so that you can quickly find all tasks created to remind you something about an OpenPaaS event. Or you can create tasks in a separate Todoist project.

Last, but not least, we wanted to implement the other way round: creating events in your calendar when you create a task in Todoist with a due date in a given project. This turned out to be impossible for now as Todoist does not send back the due date as an ingredient (a parameter of a trigger) when you use the “New task created” trigger. This information is mandatory for us in order to create the event at the correct date and time. We asked for help on Twitter and the guys proposed to help through their support center. I’m sure we’ll find a solution to this, stay tuned !

We would like to thank the guys at IFTTT for providing us developer access to their platform, and Todoist support as well for accepting to study our requirements to build even richer integrations with OpenPaaS.

You’re awesome.

Interested in joining us doing awesome code? Contact us on Github, on Twitter or apply to a job offer on our website.

--

--