An automation to enable habit tracking in Todoist Built with Lumen. Heavily inspired by the Python web service amitness/habitist with two improvements:
- Habits are reset when re-scheduled
- Support for
workday
habits
It integrates Seinfield's "Don't Break the Chain" method into Todoist. Once it's setup, you can forget about it and it works seamlessly.
-
Add habits you want to form as tasks on Todoist. Habits can either be scheduled for:
every day
every workday
-
Add
[day 0]
to the task -
When you complete the task,
[day 0]
will become[day 1]
-
If you fail to complete the task and it becomes overdue, the script will schedule it to
today
and reset[day X]
to[day 0]
-
Habits will also reset if they are re-scheduled
-
Scheduled command: This command runs every day and increments
[day X]
if a habit is complete, otherwise resets -
Resetting re-scheduled habits: The application uses Todoist webhooks to listen for updated tasks. If a habit's due date has changed, it will reset
-
Fork and clone the repo
git clone https://github.com/yourgithubusername/todoist-habits
-
Create a Todoist app and obtain an access token. You can either follow their oAuth authorisation flow using
curl
OR use the provided Test token -
Create a Heroku app + install the Heroku Scheduler & Postgres add-ons
heroku create appname heroku addons:create scheduler:standard heroku addons:create heroku-postgresql
-
Add the access token, client secret, and timezone
heroku config:set TODOIST_TOKEN='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' heroku config:set TODOIST_CLIENT_SECRET='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' heroku config:set APP_TIMEZONE='PHP_SUPPORTED_TIMEZONE'
-
Push the app to Heroku
git push heroku master
-
Finally run
heroku addons:open scheduler
and schedule the commandphp artisan todoist-habits
to run daily at midnight in your timezone
This project is licensed under the MIT License - see the LICENSE file for details