AI powered TODOs 🤖

10x your productivity, featuring Todoist, n8n (a task automation platform) and magic ✨

Posted by modernmaker on December 19, 2022 · 7 mins read

This experiment started with a simple enough thought:

What if I could incorporate AI in my workflow to help me kickstart or even save time on my tasks?

For example, what if I had the following task:

Example Flow
An example workflow leveraging AI

and I could automatically get a suggestion about a possible recipe that satisfies that prompt? That feels like magic ✨ and is exactly what we’ll have by the end of this post.

Prerequisites

You’ll need the following:

  • A Todoist account
  • A n8n account
  • An OpenAI account to produce the text from the TODO’s description1

Now, you absolutely don’t need to leverage the same tools. Do note though that this tutorial and it’s project files are tailored to the tools presented here.

1: You’ll either need a trial OpenAI account or a paid account to use OpenAI’s APIs. You can find more information here.

Overview

The workflow is simple enough:

sequenceDiagram actor Me participant Todoist participant n8n participant OpenAI Me->>Todoist: Add a new TODO Todoist->>n8n: Notify of new TODO n8n->>n8n: Continue if the TODO has the @ai-help label n8n->>OpenAI: Send prompt OpenAI-->>n8n: AI response n8n->>Todoist: Add comment on TODO
Adding some magic to your new TODO

Let’s go about implementing it.

Todoist Setup

  1. Log into Todoist’s Developer Portal by visiting https://developer.todoist.com
  2. Navigate to the app console
  3. Create a new app named n8n
  4. Navigate to the App settings section
  5. Take note of the app’s Client secret
  6. Navigate to the Test token section and create a test token
  7. Take note of Your access token
  8. Navigate to the Installation section
  9. Install the app on your Todoist account
Todoist Setup
Todoist Setup

OpenAI API Setup

  1. Log into your OpenAI account by visiting https://openai.com/api/login
  2. View your API Keys
  3. Create a new secret key
  4. Take note of the SECRET KEY
Todoist Webhook
Generate an OpenAI API Key

Summary of credentials

By now, you have 3 credentials:

  1. Todoist’s n8n app client secret
  2. Todoist’s n8n app access token
  3. OpenAI’s API secret key

Run back through the previous steps again if one of those is missing.

n8n Setup

  1. Download the n8n workflow
  2. Open it up in your favourite text editor
  3. Search and replace for all instances of [TODO: Replace by your CREDENTIAL]
  4. Save the file
  5. Log into your n8n’s account by visiting https://app.n8n.cloud/login
  6. Import the workflow in one of your instance by clicking Import from File…
  7. Name your workflow by clicking the title on the top left of your screen
  8. Save the workflow by clicking save on the top right
  9. Activate the workflow by toggling the status from inactive to active
  10. Open the Todoist Webhook node by double-clicking on it
  11. Take note of the Production URL

Your workflow won’t be ready to test yet! One last step left and you’ll be on your way.

n8n Setup
n8n Setup

Setup Todoist’s Webhook

  1. Navigate back to Todoist’s app console and open your n8n app
  2. Navigate to the Webhook section
  3. In the Webhook callback URL, paste in n8n’s Production URL previously copied over
  4. In the Watched Events section, select:
    • item:added
    • item:updated
  5. Save your webook configuration by clicking on Save webhook configuration
Todoist Webhook
Todoist Webhook Setup

Test it out!

  1. Open up Todoist
  2. Create a new Todo with the following characteristics:
    • A meaningful title
    • A description to which the AI will respond
    • The @ai-help label
  3. Wait and observe the comment added on your task (it’ll take a few seconds to appear)
  4. Marvel at how much technology has advanced

Here are some ideas of prompts:

Prepare dinner

What is a tasty chicken recipe that I can prepare for 2 people, in less than 1 hour?

Start exercising

What is a good daily 30 minutes exercise routine for beginners?

Email Mr. Smith

Follow-up with Mr. Smith about next meeting. My availabilities are Mon-Fri 9:30am - 11:30am EST. Send regards.

Protips

Customizing OpenAI’s parameters

By default, the prompt sent to OpenAI uses the text-davinci-003 model to generate a response. This parameter and others can be changed by customizing the OpenAI prompt request node in n8n, under the body field. Learn more about OpenAI’s API here.

Note that the Davinci language model is the most powerful and the most costly. See alternatives here.

Self Hosted n8n

n8n, like most workflow automation platforms, isn’t cheap! Luckily, you can self host it if you’re a bit tech savvy. I opted to host it on Digital Ocean and got it up and running within a few minutes using n8n’s handy guides.

Alternative Tooling

Truly, this workflow can be adapted to any number of tools, including alternative task management software, workflow automation platforms or AI Tools that produce text from prompts. Though the exact process will differ, the overall idea is still the same.

sequenceDiagram actor Me participant Task Management Software participant Workflow Automation Platform participant AI Me->>Task Management Software: Add a new TODO Task Management Software->>Workflow Automation Platform: Notify of new TODO Workflow Automation Platform->>AI: Send prompt AI-->>Workflow Automation Platform: AI response Workflow Automation Platform->>Task Management Software: Add comment on TODO
Generalized workflow

Project Files

You are free to use the workflow under the GNU GPLv3 license.

Download it here

Happy hacking!

Show your interest by tweeting the page and following me on social media!