Organize your tasks and manage projects.

Using the Todoist API with Trigger.dev

You can use Trigger.dev with any existing Node SDK or even just using fetch. Using io.runTask makes your Todoist background job resumable and appear in our dashboard.

  • Use io.runTask() and the official SDK or fetch.

  • Use our HTTP endpoint to subscribe to webhooks

  • Example code using Todoist

    Below are some working code examples of how you can use Todoist with Trigger.dev. These samples are open source and maintained by the community, you can copy and paste them into your own projects.

    import { TriggerClient, eventTrigger } from "@trigger.dev/sdk";
    import { z } from "zod";
    import { TodoistApi } from "@doist/todoist-api-typescript";
    // https://developer.todoist.com/rest/v2/?javascript#getting-started
    // find your api reference https://todoist.com/help/articles/find-your-api-token-Jpzx9IIlB
    const todoistClientApi = new TodoistApi(process.env.TODOIST_API_TOKEN!);
    client.defineJob({
    id: "todoist-add-new-project",
    name: "Todoist add new project",
    version: "1.0.0",
    trigger: eventTrigger({
    name: "todoist.add.project",
    schema: z.object({
    name: z.string(), // name of the project
    }),
    }),
    run: async (payload, io, ctx) => {
    // Wrap an SDK call in io.runTask so it's resumable and displays in logs
    const user = await io.runTask(
    "Add New Project",
    async () => {
    return await todoistClientApi.addProject({ name: payload.name });
    },
    // Add metadata to improve how the task displays in the logs
    { name: "Add Todoist project", icon: "todoist" }
    );
    },
    });
    ,