Action

Todoist create project API test

Posted by FlohGro, Last update over 2 years ago - Unlisted

Steps

  • script

    // create Todoist object
    var todoist = Todoist.create();
    let projectName = "this is a test project"
    let taskContent = "test content"
    
    let createTaskResponse = todoist.createTask({
    "content": taskContent
    })
    
    alert("create Task response:" + createTaskResponse)
    
    let createProjectResponse = todoist.createProject({
            "name": projectName
        })
    
        if (!createProjectResponse) {
        alert("create project response: " + createProjectResponse)
            let message = "Failed to add Project to todoist: " + todoist.lastError;
            console.log(message)
            context.fail(message);
            app.displayErrorMessage(message);
        } else {
            let message = "successfully added project in todoist with name: " + projectName;
            app.displaySuccessMessage(message);
    }
    

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.