Todoist: How to View Today’s Tasks Sorted by Project

Todoist is my favorite todo app but it's missing one REALLY critical feature. The ability to see today's tasks sorted by project.

Their default "Today" view is a total bummer. I find it unusable. Nobody goes into their Todo list to see tasks from various projects all jumbled together. If I'm working on a work project, I want to see all my urgent tasks grouped together by the context I'm working within, which is almost always by project.

It's just too hard to get a coherent view of what you need to work on for the day when tasks are mixed together without context.

As you might suspect, I came up with an awesome solution that turns this

Into this!

I'm going to show you how to make the utimate "Today" filter view. All your tasks for the day separated by project. It requires some code but it's automated. Do the work once and live forever with the perfect "Today" view.

I've customized mine to include anything that is either

  • Due today
  • Overdue
  • or Priority level 1

And I choose not to include subtasks (since they will be viewable under their parent task) or repeating tasks.

You of course can customize your "Today" filter to your liking as well.

The Manual Way

Ok before we jump into the automated stuff it's important to understand how this stuff works.

If you wanted to setup a "Today" view with tasks grouped by project, you would have to create a filter with a query that includes every project.

A filter with the query #Project 1 & (today | overdue) would show you everything due or overdue for Project 1.

A filter with the query #Project 1 & (today | overdue), #Project 2 & (today | overdue) would give you a view that first shows Project 1 tasks grouped together and then Project 2 tasks.

So let's say you've got 5 projects that each have tasks due today. You would have to create a filter query that lists each project out. And if you don't happen to have tasks due for certain projects, they're still going to show up uselessly in your view:

To make things even more annoying, you would need to update your filter every time you:

  • Add a new project
  • Delete a project
  • Change the title of a project

Or the whole thing breaks. This is far too onerous to do manually. But it's easy to keep this filter up-to-date automatically with the power of code and cloud functions!

So now that you understand how it works manually let's get to the fun part.

How to Automate the Perfect "Today" Filter

Ok let me break down how this works. We'll be writing a script that uses Todoist's API to update your "Today" filter. We'll make this script fire automatically in the cloud with something called a Google Cloud Function. Lastly we'll create something that will trigger this Cloud Function every hour (or whatever interval you choose) so your "Today" view always stays up-to-date.

If you're not very techie don't worry I'll walk you through it. But I always encourage everyone to at least learn the basics of code.

I'm not a developer and I definitely don't code every day. But it is invaluable to know enough to be able to see where and how things like this might be automated.

If you just know enough to identify the possibility of a useful automation then you can get someone to help you make it very inexpensively.

If you just know enough to identify the possibility of a useful automation then you can get someone to help you make it very inexpensively.

Ok, onto the tutorial!

Create a Google Cloud Function

This step assumes you already have a Google Cloud Platform account that is set up. If you don't, go set up your free account. Here's a step-by-step guide on how to do that.

Go to console.cloud.google.com/functions (or get their by clicking the Menu > Cloud Functions) and click "Create Function."

Give it a good name so you can figure out what it is in the future. You can't edit the name later so take a moment to set it now.

You can leave the "Region" alone. It doesn't really matter for our purposes.

Now under "Authentication" select Allow unauthenticated invocations. Then click "Save."

Now expand the "Variables, Networking and Advanced Settings" section, choose 128 MiB for "Memory allocated", and click "Next."

Now select Python 3.7 as the "Runtime". If Python 3.7 is not available to you just pick the lowest Python version available and let me know if you run into any issues.

Change "Entry point" to update.

Erase everything in the code window on the right so we can start with a clean slate.

Now click on "requirements.txt" and add a new line containing todoist-python.

This allows us to use special functionality that Todoist made for the Python language.

Now click on "main.py" to get back to the main file.

Ok before we go any further we're going to have to do a couple things in Todoist to prepare.

Create the First Filter

We're going to need to create 2 "Today" filters. The first is used to help our script figure out what tasks and projects need to be included in the second "Today" filter (the one you're actually going to use.)

Other than that you won't use the filter we're creating in this step. So make sure you don't accidentally delete it in the future or else the filter you do use will break.

Go create a new filter in Todoist. You can call it Today if you like. Or call it something else. Changing the name won't hurt anything.

If you just want to view tasks that are due today or overdue you can give it the query (today | overdue) & !subtask. I recommend including !subtask or else subtasks will show up twice (under the parent task and separately as their own entry.)

In my case I like to also include tasks with a priority of 1 and exclude tasks that are recurring. So I personally use the query (today | overdue | p1) & !subtask & !recurring.

Click on your newly minted filter and take a look at your browser's address bar. You should see something like todoist.com/app/#filter%2F2290276. Jot down the number that appears after filter%2F. In this example it would be 2290276.

Create Your Main Filter

Now let's create the filter you'll actually be using! I like to call mine ⭐ Today but call yours whatever you want. Just like you did in the previous step, write down the id number. In this example it would be 2344358. Todoist requires that you put something in the query. Put whatever you want it will get overwritten later.

Get Your Todoist API Key

You can find your API key at todoist.com/prefs/integrations from your browser, or you can get to it by clicking on:

  • The gear icon in the upper-right corner
  • Settings
  • Integrations

Scroll down and you’ll find your API key. It should look something like b0imfnc8mwsae3aaw6465jr50qtlx. Copy and save it somewhere. We’ll need it later.

Write the Code

Ok head back to your Google Cloud Function. It's time to write the code that makes the magic happen.

Copy and paste the following code into the code editor on the right, but change the following 3 things:

  • the key value with your Todoist API key
  • filter_today with the filter id from the first filter we made
  • filter_today_new with the filter id from the second filter we made
def update(request):
    import requests
    from todoist.api import TodoistAPI
    import json
    
    key = "12b3456abcdefg"
    api = TodoistAPI(key)
    api.sync()
    filter_today = api.filters.get_by_id(2290276)
    filter_today_new = api.filters.get_by_id(2344358)

    tasks = requests.get(
        "https://api.todoist.com/rest/v1/tasks",
        params={
            "filter": filter_today['query']
        },
        headers={
            "Authorization": "Bearer %s" % key
        }).json()

    proj_names = []
    for task in tasks:
        project_id = task['project_id']
        project_name = api.projects.get_by_id(project_id)['name']
        if project_name not in proj_names:
            proj_names.append(project_name)

    filter_query = ""
    catch_all_query = "!("

   
    for name in proj_names:
        filter_query = filter_query + "#" + name + "&(today|overdue|p1)&!subtask&!recurring,"
        catch_all_query = catch_all_query + "#" + name + "|"
    
    catch_all_query = catch_all_query[:-1] + ")&(today|overdue|p1)&!subtask&!recurring"
    
    if len(filter_query+catch_all_query) <= 1024: #make sure it's not too long
        filter_query = filter_query + catch_all_query
    else:
        filter_query = filter_query[:-2] #remove the ", " from the end
    
    filter_today_new.update(query=filter_query)
    api.commit()

Please note that this code is customized to my personal preferences. I like my "Today" filter to show everything that is due, overdue or of priority 1. If you don't want to see priority 1 tasks, just replace everything that says (today|overdue|p1) with (today|overdue).

Or on the other hand you might want to include both priority 1 and priority 2 tasks. In this case just change every instance of (today|overdue|p1) to (today|overdue|p1|p2)... You get the idea.

In case you need it, you can brush up on Todoist filters here.

I also omit recurring tasks. If you don't want to do that just erase every instance of &!recurring.

The Catch All

This code will be scheduled to run periodically. I set mine to run every hour. I'll show you how to do that in a moment.

But first you might be wondering... What if you create a new project and add a task that's due today? Do you have to wait until the script runs and updates your "Today" filter before you can see it?

Or what if you add a task that is scheduled for today to an existing project? Do you have to wait until the script runs to update your filter?

Well I'm glad you asked. I added a catch_all section to the end of the filter query. It looks for tasks that are due or overdue (plus whatever other criteria you specify) that does not belong to any of the projects it currently is looking for.

That way you always can see every task that you need to see for the day.

Any tasks in this "catch all" section will automatically be added to their own project section the next time the code runs. But with this "catch all" section you can feel confident that you'll never miss anything when using this "Today" filter view.

Deploy Your Cloud Function

Once you're done customizing the code click on "Deploy."

In 3 to 5 minutes your Cloud Function should be deployed into the cloud. You'll see a green check mark if it's successful.

If it doesn't work make sure your indentations are exactly consistent. Python is a stickler for indentations. Even adding an extra space can throw things off.

If you get an error you can click on the cloud function and click on the "Details" tab to see the errors. Try Googling them. Make sure you didn't erase anything small that might cause a syntax error.

Copy Your Trigger URL

Ok time to do something cool. Click on your Cloud Function. Then click on the "Trigger" tab and copy your Trigger URL.

Anytime anyone or anything visits this URL, the code in your Cloud Function will run, updating your "Today" filter. Go ahead and test it to make sure it works. Within a few moments of visiting the URL you should see your "Today" filter in Todoist magically update.

You can save this URL in case you want to manually trigger it. I saved mine as a comment in my Inbox just to keep it handy.

Ok copy that URL we'll need it for the next step.

Schedule Your Code to Run Automatically

You want your Cloud Function to run and update your filter automatically of course. You can do this for free with Google's Cloud Scheduler or you can use IFTTT or Zapier.

It's easy to do. It takes like 2 minutes. Just make sure you have your trigger URL copied to your clipboard and follow this simple guide to schedule it: How to Schedule Triggering a Google Cloud Function

Caveats

Todoist filter queries have a limit of 1,024 characters. If you have a lot of projects that are all due now, the length of this filter could exceed 1,024 characters and break. It's never happened to me but it's certainly possible if you have a lot of projects with tasks due at once or if your project names are super long.

I wrote the code to be smart enough to not add the "catch all" section if doing so would put you over the 1,024 character limit.

If you still end up exceeding the query length limit you'll get an error like this when viewing your filter in Todoist:

If you edit your filter you'll clearly see whether the issue is going over your character limit:

This is all unlikely to happen but I want to be sure to address it in case it does.

You're All Set!

I use this filter on the daily. Todoist is 1,000x better with this beautiful, custom "Today" filter! Hopefully yours is too!

Hopefully Todoist will add this functionality to the app natively but in the meantime there's no reason you can't enjoy it starting today .

Let me know how this works for you. I'd love to hear about it in the comments or on Twitter.

Did you enjoy this?

If so you might want to check out my newsletter. Get my best, most actionable insights on growth, productivity, automation, psychology and life delivered to your inbox 1x every other week. Guaranteed to be totally gangster.

Join Newsletter
Top