Import Todoist tasks into Obsidian

screencast

This page describes how to get to-dos from Todoist into Obsidian in a super flexible way.

You may also want to check: Sync tasks between Obsidian and Todoist.

Example configurations

To try and tweak this function, you can add any (or all) of these commands to your plugin.

Open the Taskbone plugin settings and use the Import command from URL function.

Import Todoist tasks (due today or overdue)

Inserts all tasks due today or overdue at your current cursor position in a format compatible to the “Tasks” plugin.

https://app.taskbone.com/assets/commands/getTasksDueTodayOrOverdueTasksStyle.json

Import tasks due on the currently open “daily note”

If your current note is a “daily note” with a name like 2023-10-01, this command looks up all tasks due on this date and inserts it at your current cursor position.

https://app.taskbone.com/assets/commands/getTasksDueAtDailyNoteTasksStyle.json

Tweaking

The examples show some basic usage options.

In the Taksbone plugin settings, look at the configuration of these commands. They have three parameters:

  • A Todoist filter for the tasks you want to import
  • A liquid template
  • An optional reference to a file that may be used during processing

The filter

The filter is a standard Todoist filter expression, as explained here: https://todoist.com/help/articles/introduction-to-filters.

Another good explanation of what you can do with filters is here: https://www.dandywithlens.com/ultimate-guide-todoist-filters/.

If you do not want to apply a filter and get all open tasks, select constant text and leave the input field empty.

The template

Everybody works a little bit different and has different ways of formatting their to-dos. You can use a liquid template to format the tasks according to your needs.

For a better editing experience, create a file in your vault to use as template. In the command’s configuration, set the template to Fixed File and reference your template there.

Here are some example templates to get you started:

Markdown

{%- for task in tasks %}{% capture line %}

{% for num in (1..task.level)%}    {% endfor %}

- [ ] {{ task.title }}

{% for label in task.labelNames %} #{{ label }}{% endfor %}

{% if task.dueDate %} #due::{{task.dueDate}}{% endif %}
 [todoist]({{ task.url }})

{% endcapture %}{{ line | strip_newlines}}
{% endfor %}

Screenshot of Obsidian

Taskpaper

{%- assign projects = tasks | map: "projectName" | uniq -%}
{%- for project in projects -%}
{{ project }}:
{% assign filteredTasks = tasks | where: "projectName", project %}

{%- for task in filteredTasks %}{% capture line %}

{% for num in (1..task.level)%} {% endfor %}

- {{ task.title }}

{% for label in task.labelNames %} @{{ label }}{% endfor %}
 @priority({{ task.priority }})
{% if task.dueDate %} @due({{task.dueDate}}){% endif %}
 @todoist({{ task.url }})


{% endcapture %}{{ line | strip_newlines}}
{% endfor %}
{% endfor %}

Screenshot of Obsidian

TODO.txt

{%- assign priorities = "0,A,B,C,D" | split: "," -%}

{%- for task in tasks %}{% capture line %}

({{ priorities[task.priority] }}) {{ task.creationDate | date: "%Y-%m-%d" }} {{ task.title }}

{% assign words = task.projectName | split: ' ' %}
{% capture titlecase %}{% for word in words %}{{ word | capitalize }}{% endfor %}{% endcapture %}
 +{{titlecase }}


{% for label in task.labelNames %} @{{ label }}{% endfor %}
{% if task.dueDate %} due::{{task.dueDate}}{% endif %}

{% endcapture %}{{ line | strip_newlines}}
{% endfor %}

Screenshot of Obsidian

Markdown Table

| status | title | created | due | labels | project | link |
| -------| ----- | ------- | --- | ------ | ------- | ---- |

{%- for task in tasks %}
{% capture line %}
|
{{ task.resolutionState }}
|
{{ task.title }}
|
{{ task.creationDate | date: "%Y-%m-%d" }}
|
{{ task.dueDate }}
|
{% for label in task.labelNames %} #{{ label }}{% endfor %}
|
{{task.projectName}}
|
{{ task.url }}
|
{% endcapture %}{{ line | strip_newlines}}{% endfor %}

Screenshot of Obsidian

Build your own

Right now, there is no really good way to write your templates in Obsidian. It is possible, but you will not get proper error messages if there is something wrong with the liquid code. While this may be fine for minor changes (or if you really know what you are doing), you could use the following workaround:

Use this template to get a JSON representation of your tasks:

{{ tasks | json }}

You can use the result in the liquid playground as context data:

{
  "tasks": THE OUTPUT OF {{ tasks | json }} GOES HERE!
}

We are working on a better way!

Example setup

It makes sense to store all templates in an Obsidian folder, e.g. taskbone/templates.

You could then setup the following commands.

Give me all tasks and prompt for the template

Screenshot of Obsidian

Maybe bind it to a hotkey. Then whenever you hit the hotkey, a dialogue like this may show up:

Screenshot of Obsidian

Get a table of tasks (over)due this week

While the first command is very flexible, you may also want to specify more specific parameters. This will get you a table of all tasks that are due this week or overdue:

Screenshot of Obsidian