Action
Add Single Todoist
Send a single task to Todoist.
Steps
-
script
// Todoist Quick Add var credential = Credential.create("Todoist", "Todoist API"); credential.addTextField("token", "Token"); credential.authorize(); // Single Task script // If text is selected, use as task name // Otherwise, leave it blank var sel = editor.getSelectedText() if (sel.length == 0) { var task = ""; } else { var task = sel; } /* ---- Prompt ---- */ var p = Prompt.create(); p.title = "Task to Todoist"; p.addTextField("task", "Task", "",{"placeholder":"task w/ date, priority, project, etc."}); p.addTextView("note", "Note", "", {"height": 50}); p.addButton("Send to Todoist"); var con = p.show(); if (con) { var task = p.fieldValues["task"]; var note = p.fieldValues["note"]; // Call API var http = HTTP.create(); // create HTTP object var response = http.request({ "url": "https://todoist.com/api/v7/quick/add", "method": "POST", "data": { "token":credential.getValue("token"), "text":task, "note":note }, }); } else { context.cancel(); }
Options
-
After Success Nothing Notification Info Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.