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.
- Python 3
- pip (included by default with Python versions >= 3.4)
- venv (included by default with Python versions >= 3.3)
- Create a virtual environment:
$ python3 -m venv .venv
- Activate the virtual environment:
$ source .venv/bin/activate
- Install requirements:
$ pip install -r requirements.txt
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:
Sign into Todoist (browser or native application), navigate to Settings > Integrations and scroll to the bottom:
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.
To run the script (the virtual environment needs to have been activated using above instructions):
$ ./execute.py
Distributed under MIT License.