Todoist Integration - Get Active Tasks (Template)

You can integrate Todoist into NotePlan using the following template which downloads all your active tasks and prints them in a list into your note. Make sure to look up your API Token and replace it with "SECRET" in the template. 

You can find your API Token in your integration settings of your account. Scroll to the bottom and copy the token text:

Template

This is template is a very simple example of how you can get all your active tasks from Todoist into NotePlan. Feel free to extend it and get more information out as needed. If you check off tasks in NotePlan they will not be synced back to Todoist in this example.

Add this template to NotePlan by copying the text below, then create a new template in NotePlan's sidebar under "Templates", select all (CMD+A), and paste everything.

---
title: Todoist Integration (Get Active Tasks)
type: empty-note 
---
<% const apiToken = 'SECRET' -%>
<%
const re = await fetch("https://api.todoist.com/rest/v2/tasks", {
	method: 'GET',
	contentType: 'application/json',
	headers: {
		'Authorization': 'Bearer ' + apiToken
	}
})
-%>
<% const parsed = (re == "Forbidden" ? null : JSON.parse(re)) -%>
### Todoist Tasks
<%- parsed == undefined ? "Your Todoist API token is invalid, look it up on todoist.com → settings → Integrations → scroll to the bottom and copy the API Token and replace it with 'SECRET' in the template" : parsed.map(p => "* [ ] " + p.content).join("\n") %>

This template will load all your active tasks into the current note:

Becomes: