Action

create Todoist task with description

Posted by FlohGro, Last update 10 months ago

created by @FlohGro / more on my Blog

create Todoist task with description

This action creates a task in Todoist with a description.

The title (first line) of the draft will used as the content of the task.

The description of the created task will contain the body (everything below the title line) of the draft.

The current draft will be moved to the trash if the task was created successfully.

[Configuration]

no configuration needed

[Usage]

If you noted a quick tasks e.g. on the go into Drafts you can provide some details (later) to it and run this action to quickly create a task in the inbox of your todoist account.


If you find this useful and want to support me you can

Buy Me A Coffee

Steps

  • script

    // created by @FlohGro
    // create todoist task with description
    
    if (draft.content.length == 0) {
        alert("Draft is blank");
        context.cancel("Draft was blank");
    } else {
    
        var todoist = Todoist.create();
    
        let taskContent = draft.processTemplate("[[title]]");
        let taskDescription = draft.processTemplate("[[body]]");
    
        let createTaskResponse = todoist.createTask({
            "content": taskContent,
            "description": taskDescription
        })
    
        if (!createTaskResponse) {
            let message = "Failed to add task to todoist: " + todoist.lastError;
            console.log(message)
            context.fail(message);
            app.displayErrorMessage(message);
        } else {
            let message = "successfully added task in todoist";
            console.log(message)
            // return relevant parameters of the
        }
    
    }
    if (!todoist.lastError) {
        app.displaySuccessMessage("successfully added task :)");
    }

Options

  • After Success Default
    Notification Info
    Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.