Todoist is a powerful task manager that can be integrated into Gen’s ecosystem. Below you’ll find everything you need to connect, authenticate, and start adding tasks programmatically.
1. Log in to Todoist 2. Go to Settings → Integrations 3. Click “Generate new token” 4. Copy the token – you’ll need it for the next steps.
We recommend adding it to an environment variable or a .env file if you’re running your own instance of Gen locally. In this demo, we’ll just use a placeholder.
The following snippet uses the Todoist REST API to create a new task. Replace YOUR_API_TOKEN
with your actual token.
// Add a task to Todoist
const token = 'YOUR_API_TOKEN';
const payload = {
content: 'Review Gen documentation',
due_string: 'tomorrow at 10am',
project_id: 1234567890 // optional, default project
};
fetch('https://api.todoist.com/rest/v1/tasks', {
method: 'POST',
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json'
},
body: JSON.stringify(payload)
})
.then(r => r.json())
.then(data => console.log('Task created', data))
.catch(err => console.error(err));
If you want to be notified whenever a task changes, set up a webhook:
// Register a webhook
const webhookUrl = 'https://your-domain.com/webhooks/todoist';
fetch('https://api.todoist.com/rest/v1/webhooks', {
method: 'POST',
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({ url: webhookUrl })
});
Gen will automatically receive POST requests at /webhooks/todoist
when any task is updated.
Want to see it in action? Check out the GIF below.
Explore the Todoist integrations page for official apps. Or dig into the full REST API docs for advanced features like labels, priorities, and custom fields.