Mac/Automator: Easily send your email to Todoist

Problem

You can't easily send your emails with Apple Mail to Todoist. And I don't want to have multiple inboxes, so I need to be able to move them.

Solution

Automator and services. It's not pretty as it's simply automating what you would manually do (but in 1 second rather than 30) but without using the Todoist API and storing the API token somewhere this is our best option.

Step one: Import this automator script or make your own

(if you don't want to use this zip file I've added steps below for you to set it up yourself - I do want to do it myself, get out of my way)

Step two: Ensure it's enabled in Services

  • Go to: System Preferences -> Keyboard -> Shortcuts -> Services
  • Ensure Send email to Todoist is ticked
  • Add a keyboard shortcut (mine is ⌃⌘T or Control + Command + T)

Open your mail client, click a message, press your keyboard shortcut and bada boom bada bing, job done.

Closing thoughts

Maybe I should just make this an API so it doesn't disrupt my workflow, but I'd have to store my Twilio OAuth token somewhere.


Make it yourself

  • Open Automator
  • Choose Service
  • Drag in (from the action library) Mail -> Get Selected Mail Items
  • Drag in Utilities -> Run AppleScript and paste in
tell application "Mail"  
    set _sel to get selection
    set _links to {}
    repeat with _msg in _sel
        set _messageURL to "Link: message://%3c" & _msg's message id & "%3e"
        set emailSubject to _msg's subject
        set end of _links to _messageURL
    end repeat
    set AppleScript's text item delimiters to return
    set the clipboard to (_links as string)
    return emailSubject
end tell  
  • Drag in Utilities -> Launch Application and ask it to open Todoist
  • Drag in Utilities -> Run AppleScript and paste in
on run {input, parameters}

    tell application "System Events"
        keystroke "q" -- q is the shortcut to quickly add a new task in todoist
        delay 0.2
        keystroke "Process email: " & input
        delay 0.2
        key code 46 using {command down} -- 46 = m, this is to open the quick comments box
        delay 0.2
        key code 9 using {command down} -- key code 9 is 'v', so this will paste what we copied above
        keystroke " " -- space so it knows we entered something (it's not registering the paste as inputting a comment)
        delay 0.2
        key code 53 -- Close quick comments box with 'escape'
        delay 0.1
        keystroke tab -- Into the actual title input for the task
        delay 0.1
        keystroke return -- enter to add the item
        delay 0.3
        key code 48 using {command down} -- Go back to where we were with Command + Tab (48)
    end tell
    return input
end run  
  • Save it with ⌘+S as 'Send email to Todoist' then go to Step two