Skip to content

Python 3 script to migrate to-do lists in Notion to tasks in Todoist.

License

Notifications You must be signed in to change notification settings

blairnangle/notion-to-todoist

Repository files navigation

Notion to Todoist

Python 3 script to migrate to-do lists in Notion to tasks in Todoist.

Makes use of the unofficial notion-py library and official Todoist REST API.

Prerequisites

  • Python 3
  • pip (included by default with Python versions >= 3.4)
  • venv (included by default with Python versions >= 3.3)

Installation

  • Create a virtual environment:
$ python3 -m venv .venv
  • Activate the virtual environment:
$ source .venv/bin/activate
  • Install requirements:
$ pip install -r requirements.txt

Usage

Obtaining API Keys

Notion

Until Notion releases a public API, the (hacky) way to get an API token is to sign into Notion on a web browser and copy the authentication cookie. For example, using Chrome's DevTools:

Notion Cookie API V2 Token

Todoist

Sign into Todoist (browser or native application), navigate to Settings > Integrations and scroll to the bottom:

Todoist Settings Integrations API Token

Configuring

Your config.yml file should look similar to:

# Notion-specific config
notion:
    user: "blairnangle"
    api_token: "the token you grabbed from your browser"

# Todoist-specific config
todoist:
    api_token: "the token you grabbed from Settings > Integrations"

# Configure migration of a to-do list on a Notion page to tasks in a Todoist project
migration:
    - notion: "Reading-List-2657c435b8654900a1f14850aca28daa"
      todoist: "Reading List"
    - notion: "Shopping-List-24a61811037742894c3a395f9d72ddae"
      todoist: "Shopping List"

Notion pages must consist entirely of "To-do list" blocks.

If a project does not already exist for a Todoist project, it will be created.

Running

To run the script (the virtual environment needs to have been activated using above instructions):

$ ./execute.py

License

Distributed under MIT License.

About

Python 3 script to migrate to-do lists in Notion to tasks in Todoist.

Resources

License

Stars

Watchers

Forks

Languages