Todoist Add

Posted by @joelberger76, Last update almost 6 years ago

Add tasks to Todoist via Quick Add API. See the following link for help with syntax:


  • script

    var todoistURL = "";
    //Read token from file in iCloud
    //var fmCloud = FileManager.createCloud(); // iCloud
    //var token ="/TodoistToken.txt");
    //if (token == "undefined") {
      //console.log("File not found");
    var credential = Credential.create("Todoist", "Todoist API Key");
    credential.addPasswordField("apiKey", "API Key");
    var token = credential.getValue("apiKey");
    var lines = draft.content.trim().split('\n');
    var task = '';
    for(var ix in lines) {
       task = lines[ix];
       //Todoist parsing doesn't treat Tod and Tom as dates
       task = task.replace("Tod", "tod");
       task = task.replace("Tom", "tom");
       // create HTTP and make POST request to Todoist
       var http = HTTP.create();
       var response = http.request({
         "url": todoistURL,
         "method": "POST",
         "encoding": "form",
         "data": {
            "token": token,
            "text": task
       // log result
       // if not 200 OK, fail the action
       // Otherwise Todoist successfully received post
       if (response.statusCode != 200) {;


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