I’ve been using Habitica for a little over a year now and absolutely love it. It’s basically just a complicated To-Do list with some different options around repeating tasks with a mix of gamification to keep me interested. Over the past couple of weeks there have been times when I have found myself having my hands full and not being able to manually add tasks when I wanted to. So the next obvious step is to figure out a way around that.
Start a metronome (for two minutes), tune an instrument or play any desired note. I say 'OK Google, let me talk to Todoist' The Todoist assistant shows up to help - you can tell because the voice changes. Then I say 'Add a task 'Water the plants' or 'Add a task”, then Todoist asks “What is the content” and then I say “Water the plants”. Either way Todoist accepts the input.
Google Assistant
I recently got the Google Pixel and have been attempting to work my entire life around Google Assistant. My problem seemed like an obvious candidate to be solved using the voice commands with my phone, so I started investigating into the Assistant. Unfortunately I couldn’t find any way of hooking up the Google Assistant directly to Habitica. So I figured I would need to add some sort of intermediary step between Google Assistant and Habitica.
IFTTT and todoist and Maker
Moschip network & wireless cards driver. I’ve used IFTTT for automating a few random things in my life, so checked out IFTTT first. Stumbled upon todoist as a great “this”, it works perfectly with Google Assistant and seems to be easily configurable.
For the “that” section, I needed to be able to connect to Habitica. Habitica has a pretty decent API, tested it out in Postman and seemed to fulfill my needs:
headers:
body:
I found a “that” section called “Maker” in IFTTT that allows you to send HTTP requests. The only problem with Maker is that it doesn’t let you supply headers with the request, which obviously means that I wasn’t going to be able hit Habitica directly from IFTTT.
Intermediate Node.js App
Since I can still make HTTP requests from IFTTT, I decided to throw together a Node.js application that sits between IFTTT and Habitica. The simple app had the following requirements:
- Can receive requests with everything in the URL.
- Has some type of token authentication so that I can verify that only I can add tasks to my To-Do list
- Has the ability to make requests to Habitica with my Habitica API credentials and a task.
This is what I was able to come up with. Drivers nbs printers. Super simple application that does some basic key checking for verification, then makes a request to Habitica with the required tokens and the task to be created. Most of the logic sits on the index.js file and is as follows:
Once it was all good to go, I pushed it up to Heroku so I can access it from IFTTT. To utilize it, it’s just a simple get request to “/todo/:key/:task”, where key
is the UUID that I created for the app and task
is the new task to be added to my To-Do list.
Wrapping Up
So the final workflow for the “task” is as follows:
- I tell Google Assistant: “Note to self, mow the lawn”
- Google Assistant adds the task to my todoist list
- IFTTT polls my todoist lists for new tasks and picks it up
- IFTTT triggers and calls my endpoint with the endpoint API key
- My endpoint verifies the key and hits the Habitica API with my API user/token and the new task
- Habitica adds my new task to my To-Do list.
- I probably procrastinate mowing the lawn anyway…
It was a bit frustrating that Maker doesn’t allow for headers, but was able to get around it with my quick app. Ideally long term the better solution would to be able to go right from Google Assistant to Habitica, but for now I have filled my needs!
If anyone has any suggestions or improvements feel free to shoot me an email.
Category
Languages
English
More
Google Assistant is ready to help, anytime, anywhere — at the touch of the home button or with your Google Home speaker device. Ask it questions. Tell it to do things. It's your own personal Google, always ready to help whenever you need it. And with Todoist, you can get even more done.
You can use the integration to add, complete, and check in on your Todoist tasks without ever opening the app. From cleaning your car to hearing about your upcoming day, this integration helps you get more done on-the-go. Here’s what you can do:
Features
Google Assistant Todoist
Find out what’s coming up next by asking Google: 'What do I have due today?'
Add tasks with due dates using natural language, like: 'Add a task to pick up the kids tomorrow at 4pm.'
Stay organized and on top of it all by adding priority levels, labels, and projects to any task you add, like “Set priority one, add label important, and move to project Family.”
Check things off your list with a simple: “Complete my task to pick up the kids.'