Keep tasks in sync between Todoist and Obsidan

Screencast

There are two different kinds of commands to sync tasks between an Obsidan document and Todoist.

Two basic examples of these are:

  • Sync with Todoist (tasks-style) (https://app.taskbone.com/assets/commands/updateTodoistAndSyncStateTasksStyle.json)
  • Sync project tasks (https://app.taskbone.com/assets/commands/syncBasedOnProject.json)

If you do not have them, you can use the Import from URL function in the plugin settings and enter the respective URL.

Sync with Todoist (tasks-style)

This command will check the active document for open tasks and create them in Todoist, if they do not yet exist. It will add a link to the task in the Markdown.

You can mark these as done in either Todoist or Obsidian. The next time you run the command the states will be synced.

Customizing

If you look at the options for this command you can see, that it takes a lot of inputs:

  • text: The text you want to check for new tasks
  • taskRegex: A regular expression used to identify tasks in the text

The following settings are applied for every tasks found in the document (based on the taskRegex):

  • level: Level of the task (How to find out how deep of a sub-task this is?)
  • state: State (“resolved” or “open”)
  • title: Title of the task
  • description: Description
  • projectName: The project name
  • labelNames: List of labels as JSON array (e.g. ["label1", "label2"])
  • dueDate: When is the task due
  • priority: Priority of the task
  • todoistId: If the task is already in Todoist, what is the id?

More general configs:

  • updateTemplate: Liquid template used to create the updated document based on the synced tasks
  • ignoreFieldsOnUpdate: Which fields NOT to update from Obsidan to Todoist (by default only the state and the hierarchy information is updated)

With the exception of taskRegex and ignoreFieldsOnUpdate all inputs can be liquid templates (even text). This way all sorts of formats and fancy notations can be supported. For the inpust specifying the task details, the template receives the following data:

  • task (result of the regex match), with:
    • match: the matching text
    • index: the position in the (rendered) text
    • lineNumber: the line number of the match in the (rendered) text
    • [name]: named capture group of the regex
  • vaultName
  • filePath: Path of the text-file, if any
  • metadata: Metadata of the text-file, if any, with:
    • tags
    • frontmatter

Sync project tasks

This command syncs an Obsidian document with a Todoist project. It will check the frontmatter of your document for a Project parameter. When syncing, all tasks you added to this page will be added to the project.

New tasks you added to the project in Todoist will be created in Obsidian.

Screencast

  • If the project doesn’t exist yet, it will be created with the sync of the first task.
  • If you do not specify a project, the command will sync your inbox.

Customizing

The inputs for this command are almost the same as for the other command. The only difference is the additional filter parameter. It specifies which filter to use for adding new tasks to the document. In this case, the filter by project in the frontmatter:

{% if metadata.frontmatter.Project %}#{{ metadata.frontmatter.Project }}{% else %}#Inbox{% endif %}