This is a submission for the Nylas Challenge: Galaxy Brain.
What I Built and Why
You probably know SQL for relational databases. But what if you could use it to manage your emails and calendar events? That's what I wanted to explore.
It's a bit strange, but actually, it's fun and useful.
Anyquery is a SQL query engine. I created a plugin for it with Go to make it compatible with Nylas, allowing anyone to manage their emails and events with SQL.
My main motivation was bulk editing. Let's say I was wrong on the location of a recurrent event. I would need to modify each event location. Using SQL, I can just do
UPDATE nylas_events
SET location = 'Eiffel tower`
WHERE title = 'Dentist';
Moreover, imagine that I have to send bulk emails to my customers. I can just do
INSERT INTO nylas_emails("to", body, subject)
SELECT email, 'New version 0.3.1', 'Discover the update'
FROM my_customers;
Or export my 10 next upcoming events to JSON
anyquery -q "SELECT * FROM nylas_events WHERE start_at >= date()" --json
SQL is a very powerful language and this plugin opens a new world of possibility.
Demo
I have recorded a little demo where I show you:
- How to query your calendar events
- How to add an event using an
INSERT INTO
statement - How to update an event using an
UPDATE
statement - How to delete an event using a
DELETE
statement - How to list your unread emails using a
SELECT
statement - How to send an email using an
INSERT INTO
statement - How to trash emails using a
DELETE
statement
I'm using TablePlus as the SQL IDE, and Anyquery in MySQL mode to run the plugin I made.
Code
As plugins are required to be in the main repository of anyquery, the plugin I built is available in the plugins/nylas
directory, and with an MIT License
https://github.com/julien040/anyquery/tree/main/plugins/nylas
You can install it by running anyquery install nylas
. You'll need anyquery installed, and a Nylas sandbox account set up with a grant ID and an API key.
My Journey
The Nylas APIs were of great help to query and modify data from different calendar/email providers. I'm particularly proud of the seamless integration with the SQL query engine.
While this project is a submission for the hackathon, I'm pretty sure I'll use it weekly, and others might too. Managing productivity tools with a declarative language is an efficient and effective approach.
Top comments (3)
If you have any suggestions, feel free to comment them and I'll be happy to add them to the plugin !
That is a pretty cool idea!
Thank you Dmitry !