An instant (and automated) webclipper for Evernote

I frequently use the Evernote webclipper on my Mac but wanted something which:

A. Would work instantly i.e. eliminate the wait for the webclipper to capture, upload and sync the page
B. Could be triggered faster with less interaction / fewer mouse clicks than the webclipper

So I’ve strung together an alternative solution which instantly clips the full contents of the current browser tab as a long single-page PDF and automatically saves it to the relevant Evernote notebook in the background. There’s no need to wait for clipping or syncing: the browser tab can be closed immediately.

I want to explain my solution here, and throw it open to improvements from the community: I’m sure it could be improved!

There are really two parts to this solution

1. The ‘trigger’ i.e. how the workflow is activated
My approach could be entirely customised or replaced with a keyboard shortcut in order to broaden compatibility to Macs without touchbars.

My approach requires BetterTouchTool (for the Touchbar integration) and Alfred, but could be implemented as a keyboard shortcut or Alfred command, without using BetterTouchTool

2. The automated page capture and upload to Evernote
This users Zapier (at least a Starter account), PhantomJSCloud (free for up to 500 pages per day) and a Dropbox account.

How the trigger works

  1. User taps ‘Evernote elephant’ button on the touchbar

  2. User selects destination notebook on the touchbar (“Web Clips”) in this example

  3. BetterTouchTool runs the following AppleScript

    tell application “Safari”
    set _pageURL to the URL of front document as string
    set _noteTitle to the name of front document as string
    set _pageTitle to the name of front document as string
    end tell

    tell application “Alfred 3”
    run trigger “webclips” in workflow “com.zapier.alfredbasic” with argument _pageURL
    tell application “System Events” to key code 36
    end tell

  4. The AppleScript activates an Alfred Workflow which triggers a Zapier web hook

How the page capture and upload works

  1. The trigger has now activated the Zapier webhook. Your zap should look something like this its fully set up

  2. In the Zapier zap, the webhook trigger should be configured as “Catch Hook”, with “Silent Mode” left unticked, and the “Pick off a child key” field left empty

  3. The second stage of the Zap is a “Custom Request” for “Webhooks by Zapier”. This will use PhantomJS to capture the page as a PDF. The custom request template should be as follows:

Method: POST
Data Pass Through: No
Data: {“url”:“ZAPIER_STEP1_QUERY_STRING_NOTE”,“renderType”:“pdf”,“renderSettings”:{“pdfOptions”:{“format”:“onepage”}},“outputAsJson”:false}
Unflatten: yes
Basic Auth: leave empty
Headers: Leave empty

  1. The third stage of the zap is to upload the resulting PDF to dropbox. The Zapier template should be:

Folder: [your_choice_of_dropbox_folder]
File: Select “Step 2, Exists but not shown’ from the dropdown
Overwrite: yes
Specify File Name: Select ‘Step 1 Querystring Keywords’
Specify File Extension: .pdf

  1. The final stage is to create a new Evernote note and upload the PDF from Dropbox to Evernote. The Evernote action is ‘Create Note’. The template is:

Notebook: select the relevant notebook from the dropdown
Title: select Step 1, Catch Hook, Querystring Note from the dropdown
Content: Step 1, Catch Hook, Querystring Note
Tags: whatever you want
Reminder time: leave blank
Reminder Done time: leave blank
Attachment: select: Step 3 > Upload File > Direct Media Link

Limitations of this solution

  1. This solution won’t work with any pages which require a login
  2. It requires a separate Alfred workflow and separate Zapier zap for each destination notebook which you want to make available to the TouchBar trigger

Obvious room for improvement

  1. The current trigger mechanism is pretty inelegant in the way it uses Alfred as a ‘middleman’ to trigger the web hook. I’d prefer to trigger the web hook directly from BetterTouchTool - but couldn’t figure out how to do it.
  2. Capture the name of the page, and use that to name the Evernote note and the PDF.