Action

ReadLater: NotePlan & Things

Posted by Reddit: @alkomy, Last update about 12 hours ago

UPDATES

about 12 hours ago

Line 8 now uses draft.processTemplate("[[body]]") instead of draft.content, so NotePlan will display the title once at the top, followed by the body content below it.

Send draft to NotePlan as new note. Then create a new Task with NotePlan note’s link into Things

  • NotePlan content in Markdown.
  • Things Task: Title: First Line Description: Draft content + Link to note (easy to open note on Mac/iOS) Project : πŸ“– Read Later Heading: Read Later on NotePlan Tag: πŸ“˜ ReadLater

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 only the body (content after first line)
    noteplan.addParameter("text", draft.processTemplate("[[body]]"));
    // Add note to specific folder
    noteplan.addParameter("folder", "Drafts");
    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;
        
        const title = draft.title;
        const notes = draft.content + "\n\n" + noteplanURL;
        
        // Create task in Things using URL scheme
        const things = CallbackURL.create();
        things.baseURL = "things:///add";
        things.addParameter("title", title);
        things.addParameter("notes", notes);
        things.addParameter("list", "πŸ“– Read Later");
        things.addParameter("heading", "Read Later on NotePlan");
        things.addParameter("tags", "πŸ“˜ ReadLater");
        
        things.open();
    } 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.