Jump to content

Outlook for Mac and Todoist workflow needed


Recommended Posts

I'm looking for help in creating a workflow, I want to have the ability to send Outlook for Mac 2016 emails to my Todoist inbox running a script via Alfred. I've looked everywhere and can't seem to find one that works or it's for the old version of Outlook?

 

Can anyone help?

Edited by djsharpe
Link to post

Hi djshare,

 

I'm not sure I can understand (due to my poor english). Is "Todoist inbox" a "folder" in Outlook app (so you want to send to and receive a mail from Outlook) or do you speak about the Todoist's application ?

 

Did you try with AppleScript?

 

What are your requirements, exactly? What do you want to do (in dumb language :-))?

 

Bien à toi,

 

Phil

Link to post

This script returns information (subject, text, sender, data) about the selected message in Outlook. You should be able to plug it into one of the older workflows.

 


// Display an error dialog if no message is selected
var showDialogOnError = true

ObjC.import('stdlib')

outlook = Application('Microsoft Outlook')
sa = (outlook.includeStandardAdditions = true, outlook)

// Return the first selected object that's a message
function getSelectedMessage() {
    var selection = outlook.selectedObjects()
    for (i = 0; i < selection.length; i++) {
        var obj = selection[i]
        if (obj.class() == 'incomingMessage') {
            return {
                'subject': obj.subject(),
                'text': obj.plainTextContent(),
                'sender': obj.sender(),
                'date': obj.timeSent(),
            }
        }
    }
    return null
}

// Return JSON object containing the selected message
function run() {
    var msg = getSelectedMessage()
    if (!msg) {
        if (showDialogOnError) {
            sa.displayDialog('No message selected', {
                buttons: ['OK'],
                defaultButton: 'OK',
                withTitle: 'Error',
                withIcon: 2
            })
        }
        $.exit(1)
    }
    return JSON.stringify(msg)
}

 

Edited by deanishe
Link to post

Thanks for responding!

 

I use Todoist to complete my daily tasks. Todoist has an inbox that I send things to that I later will complete or file to do another day. I use Outlook for Mac 2016 for my emails. What I'm looking for is:

 

When I'm going thru my emails in Outlook for Mac 2016 I would like an Alfred workflow that I can use to send a link of the Outlook for Mac email to my Todoist inbox for processing later. 

 

Ideally the workflow would take the Outlook for Mac email and create a new item in my Todoist inbox with the subject of the email being the title of the Todoist task, the body of the email would be in the notes section of the Todoist task with a link back to the Outlook email so I could click on it from Todoist to take me back to Outlook to answer when I'm ready. 

 

Link to post
13 minutes ago, djsharpe said:

a link back to the Outlook email so I could click on it from Todoist to take me back to Outlook to answer when I'm ready. 

 

Can't be done as best as I can tell. Outlook's AppleScript API doesn't give you the message ID you need to create a link, nor does it support the message:// URI scheme needed to link back to your email app.

 

If this is really important to you, and you're not using Exchange, I suggest you check out MailMate, which has Todoist support out of the box.

 

Apart from that, the script I posted can be plugged into the Todoist Python API pretty simply.

Link to post

Thanks for the explanation, @djsharpe.

 

An interesting exercice. As far as I know, Todoist works with a Rest API. So AppleScript + Url should do the trick.

  • Get the selected message in Outlook,
  • send a rest request to Todoist (with title, sender, and so on).

In the body (note), a link for Outlook to open the message.

 

Link to post
1 minute ago, PhilIcare said:

As far as I know, Todoist works with a Rest API

 

There's a Python API library. You'd be crazy not to use it.

 

2 minutes ago, PhilIcare said:

So AppleScript

 

Yeah. I already posted the script for that…

 

2 minutes ago, PhilIcare said:

In the body (note), a link for Outlook to open the message.

 

Like I said, Outlook doesn't support that.

Link to post
2 minutes ago, deanishe said:

 

That's writing an entirely new application.

 

What does node have to do with anything?

 

 

Very hard for me in english…

 

If you already have a nodejs server running on a port, it's easy to send a request to run a dedicated osascript : `localhost:1337/message/15/show`

 

15 is a message ID, stored in a mysql table (for instance) with all the message information (folder and so on).

 

Tell me if I'm wrong ;).

 

It's not a entirely new application. Outlook is an application, Todoist is an application, this idea is just a hack. To solve a problem. Sorry if I'm wrong.

 

Cheers

 

 

 

 

Link to post
17 minutes ago, PhilIcare said:

Tell me if I'm wrong ;).

 

Wrong? That sounds pretty crazy. Why would you consider using a very large application server and a web-scale RDBMS for such a small, simple problem? How would you populate the database in the first place?

 

All you need is a relatively simple application that handles message:// URLs (which is the standard way to do this on macOS). It extracts the message ID from the URL, then runs the AppleScript/JXA necessary to make Outlook show the corresponding message.

 

No need to run huge server programs.

 

And yes, it is an entirely new application. Not a big one, but the links can't work without it because Outlook doesn't support the standard message:// URI scheme.

 

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...