Action
ReadLater: NotePlan & Todoist
Posted by Reddit: @alkomy,
Last update
about 1 hour ago
UPDATES
about 1 hour ago
Remove duplicate title, by using drafts body instead of drafts content.
Send draft to NotePlan as a new Note. Then create a new Task (Title & Description with NotePlan link) into Todoist inbox.
Steps
-
defineTemplateTag
name content
template [[body]]
-
script
// Create a new note in NotePlan const noteplan = CallbackURL.create(); noteplan.baseURL = "noteplan://x-callback-url/addNote"; // Use the first line of the draft as the title in NotePlan noteplan.addParameter("noteTitle", draft.title); // Use the body content of the draft for the text noteplan.addParameter("text", draft.processTemplate("[[body]]")); noteplan.addParameter("openNote", "no"); const success = noteplan.open(); if (success) { // Construct the NotePlan URL to open the created note const encodedTitle = encodeURIComponent(draft.title); const noteplanURL = "noteplan://x-callback-url/openNote?noteTitle=" + encodedTitle; // Create task in Todoist using Drafts Todoist integration var todoist = Todoist.create(); let taskContent = draft.processTemplate("[[title]]"); let taskDescription = draft.processTemplate("[[body]]") + "\n\n" + noteplanURL; let createTaskResponse = todoist.createTask({ "content": taskContent, }); 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); app.displaySuccessMessage("Successfully created note in NotePlan and task in Todoist!"); } } else { // If NotePlan call fails, log the error console.log(noteplan.callbackResponse.errorMessage); context.fail(); }
Options
-
After Success Archive Notification Info Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.