I live a large part of my productive life out of Todoist. I make plans for personal things, like kids birthday parties and work things like fixing bugs, implementing larger projects, or updating documentation. It’s all in Todoist in some form or fashion. Todoist has a pretty nice API for reading and writing into my account. I have a list of automation and integrations I want to do between other apps I use like Slack or Gmail.

I wrote a Google Script that builds a completed task report and sends it to me every morning. When interacting with my Todoist data, I had to do a few things.

  1. Create a new “Todoist App” in the Todoist App console. I generated a test token that I use to interact with the API and my Todoist data.

  2. Create a new Google Script app project, which is super straighforward. I added the Todoist app token as a script property.

The Todoist API endpoint I needed to use to get completed tasks was:

https://api.todoist.com/sync/v8/completed/get_all

There’s some more documentation for this endpoint here. I added two query parameters since and until to only retrieve completed tasks for a given time period, in my case, the day before. That API call looks like:

https://api.todoist.com/sync/v8/completed/get_all?since=2019-08-01T00:00&until=2019-08-01T23:59

The returned JSON data:

{
	"items": [{
		"content": "Establish the budget",
		"meta_data": null,
		"user_id": 67234892,
		"task_id": 2345678,
		"project_id": 987654732651,
		"completed_date": "2019-08-08T19:42:15Z",
		"id": 2345678
	}, {
		"content": "Create the evite",
		"meta_data": null,
		"user_id": 67234892,
		"task_id": 3292416862,
		"project_id": 987654732651,
		"completed_date": "2019-08-08T19:42:11Z",
		"id": 3292416862
	}],
	"projects": {
		"987654732651": {
			"name": "Party Planning",
			"is_favorite": 0,
			"color": 46,
			"is_deleted": 0,
			"collapsed": 0,
			"parent_id": 2345234,
			"child_order": 1,
			"is_archived": 0,
			"id": 987654732651
		}
	}
}

The rest is just a matter of writing the Google Script code to build and send the email report.

Finally, I created a Google Script time trigger to execute this script every morning.

I’ll be uploading code as I complete it to Github.

🧇