|
| 1 | +--- |
| 2 | +title: "Automating New Projects in Todoist with Python" |
| 3 | +date: "2025-10-30" |
| 4 | +description: "A small set of Python scripts that build out a complete Todoist project—sections, tasks, and sub‑tasks—from a simple JSON file." |
| 5 | +author: "Amanda Nelson" |
| 6 | +tags: ["automation", "todoist", "python", "workflows"] |
| 7 | +image: "https://media.beehiiv.com/cdn-cgi/image/fit=scale-down,format=auto,onerror=redirect,quality=80/uploads/asset/file/b585a570-ef5f-4988-a0bf-752b4e2d2a95/Beehiiv_Banner.png?t=1746662710" |
| 8 | +--- |
| 9 | + |
| 10 | +# Automating New Projects in Todoist with Python |
| 11 | + |
| 12 | +Yesterday I built a small, friendly set of scripts to remove the friction of spinning up a new project in Todoist. Instead of clicking around to add sections and tasks, I now drop a short JSON file into a folder and run one command. Two minutes later, the whole project is ready for real work. |
| 13 | + |
| 14 | +Repo: [devandapaige/todoist](https://github.com/devandapaige/todoist) |
| 15 | + |
| 16 | +## What it does |
| 17 | + |
| 18 | +- **Creates or reuses a project**: If a project with the same name exists, it adds to it rather than duplicating it. |
| 19 | +- **Builds structure fast**: Adds sections, tasks, and optional sub‑tasks from a plain JSON file. |
| 20 | +- **Keeps focus on your flow**: I designed this to reduce cognitive load at the exact moment I’m shifting into a new initiative. |
| 21 | + |
| 22 | +## Why this matters for brain-and-energy aware work |
| 23 | + |
| 24 | +The first few minutes of any project are decision-heavy. By externalizing the structure—what sections I use, which tasks always start a project—I protect my energy for the meaningful parts. This is a tiny automation that creates space for momentum and reduces startup anxiety. |
| 25 | + |
| 26 | +## Quick start |
| 27 | + |
| 28 | +1) Create a virtual environment and install deps |
| 29 | + |
| 30 | +```bash |
| 31 | +python3 -m venv .venv |
| 32 | +source .venv/bin/activate |
| 33 | +python -m pip install --upgrade pip |
| 34 | +python -m pip install todoist-api-python python-dotenv |
| 35 | +``` |
| 36 | + |
| 37 | +2) Add your Todoist API token |
| 38 | + |
| 39 | +```bash |
| 40 | +echo "TODOIST_API_TOKEN=your-token-here" > .env |
| 41 | +``` |
| 42 | + |
| 43 | +3) Define your project data |
| 44 | + |
| 45 | +```json |
| 46 | +{ |
| 47 | + "project_name": "Client Project Template", |
| 48 | + "sections": [ |
| 49 | + { |
| 50 | + "name": "Planning", |
| 51 | + "tasks": [ |
| 52 | + { |
| 53 | + "content": "Kickoff notes", |
| 54 | + "sub_tasks": [ |
| 55 | + { "content": "Confirm goals" }, |
| 56 | + { "content": "List stakeholders" } |
| 57 | + ] |
| 58 | + }, |
| 59 | + { "content": "Define scope", "sub_tasks": [] } |
| 60 | + ] |
| 61 | + }, |
| 62 | + { |
| 63 | + "name": "Execution", |
| 64 | + "tasks": [ { "content": "Set up repo" }, { "content": "First milestone" } ] |
| 65 | + } |
| 66 | + ] |
| 67 | +} |
| 68 | +``` |
| 69 | + |
| 70 | +4) Run the importer |
| 71 | + |
| 72 | +```bash |
| 73 | +python import_to_todoist.py |
| 74 | +``` |
| 75 | + |
| 76 | +You’ll see progress logs as the project, sections, tasks, and sub‑tasks are created. If the project already exists, the script adds the new structure to it. |
| 77 | + |
| 78 | +## Notes and tradeoffs |
| 79 | + |
| 80 | +- The importer intentionally adds tasks each run; it doesn’t try to de‑duplicate similar items. That keeps the script simple and predictable when you’re iterating on templates. |
| 81 | +- Put the `.env` file next to `import_to_todoist.py`. The script loads it automatically. |
| 82 | +- If you prefer environment variables, export `TODOIST_API_TOKEN` instead of using `.env`. |
| 83 | + |
| 84 | +## How I’m using it |
| 85 | + |
| 86 | +I turn long AI chats into actionable Todoist projects by asking the model for a single JSON payload in the importer’s format. I paste that JSON into `project_data.json` and run the script—done. |
| 87 | + |
| 88 | +### Prompt I use (short and strict) |
| 89 | + |
| 90 | +```text |
| 91 | +You are helping me turn our conversation into an actionable Todoist project. |
| 92 | +
|
| 93 | +Return ONLY valid JSON in this exact schema (no prose): |
| 94 | +{ |
| 95 | + "project_name": "<short-name>", |
| 96 | + "sections": [ |
| 97 | + { "name": "<section>", "tasks": [ |
| 98 | + { "content": "<task>", "sub_tasks": [ { "content": "<subtask>" } ] } |
| 99 | + ]} |
| 100 | + ] |
| 101 | +} |
| 102 | +
|
| 103 | +Rules: |
| 104 | +- Use 3–6 sections that reflect this chat’s themes. |
| 105 | +- Each section: 3–7 tasks. |
| 106 | +- Use clear, verb-led task names. |
| 107 | +- Include sub_tasks only where they reduce ambiguity. |
| 108 | +- Do not include comments, markdown, or trailing commas. |
| 109 | +``` |
| 110 | + |
| 111 | +### Workflow |
| 112 | + |
| 113 | +1. Summarize the chat in my head into 3–6 themes (sections). |
| 114 | +2. Run the prompt with a one‑line context: “Topic: `what we discussed`.” |
| 115 | +3. Paste result into `project_data.json`. |
| 116 | +4. `python import_to_todoist.py` to create the project. |
| 117 | + |
| 118 | +This isn’t flashy; it’s deliberately boring—in a good way. It removes the micro‑decisions that slow me down and lets me get to the work that actually needs my attention. |
| 119 | + |
| 120 | +With digital care, |
| 121 | + |
| 122 | +The Pythoness Programmer |
| 123 | + |
| 124 | +<Signature /> |
| 125 | + |
| 126 | +Amanda |
| 127 | + |
| 128 | +Reference: the full README, setup steps, and example JSON live in the repo: [devandapaige/todoist](https://github.com/devandapaige/todoist). |
| 129 | + |
| 130 | +Find the code on GitHub: [devandapaige/todoist](https://github.com/devandapaige/todoist) |
| 131 | + |
0 commit comments