Last active
December 8, 2024 19:31
-
-
Save Maxr1998/82cebde74a4845cb485ac0d5a6dbefa6 to your computer and use it in GitHub Desktop.
Python script to delete completed tasks from your Todoist Inbox
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import todoist | |
api = todoist.TodoistAPI(token='<your_token_here') | |
# Initial sync of your account | |
api.sync() | |
# Find Inbox in project - can be adapted to delete completed tasks for other projects as well | |
projects = api.projects.all() | |
inbox = next(p for p in projects if 'inbox_project' in p) | |
# Process tasks until explicitly aborted | |
while True: | |
# Get completed tasks for project, a maximum of 100 tasks is supported per batch | |
completed = api.items.get_completed(project_id=inbox['id'], limit=100) | |
if not completed: | |
break # No completed tasks left, abort | |
# Delete the completed tasks | |
for c in completed: | |
api.items.delete(c['id']) | |
# Commit deletion requests | |
api.commit() |
Maybe we can change the content before deleting, but I imagine that is also stored in the activity log. At this point then, we need a different more private to-do app, perhaps one with end-to-end encryption on the content of tasks. Only end-to-end encrypted to-do app I know of is Lunatask https://lunatask.app/ and note-taking apps like Joplin, but Lunatask isn't fully supported on mobile yet.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for sharing the code, @dmbeta!
I played with it for a while but eventually gave up for the following reasons:
Thanks again.