Jump to content

Recommended Posts

ALFRED TODOIST WORKFLOW

Add and search Todoist tasks straight from Alfred. It uses Todoist v7 API.

Prerequisites

  • For this workflow to work you need version 3.x of Alfred and a powerpack licence.
  • For adding projects or labels to a new task and for searching for a task, the project uses use Node.js. If you want these features, an installation command is provided.

Installation

Download and import workflow.

For updates use the t:update command.

Add Tasks

add-task.gif

Alfred command

todo {task}, {date}, {project}

Example: todo Get things done, tomorrow @ 9, work
Example: todo Build tree house #home !!2 @15min, tomorrow @ 9
* #project @label and !!priority will be parsed from anywhere in the text

Task

Can be any string as long as there are no comma's in it. Markdown in the string will be parsed (in the Todoist app), but anything else won't.

Date

See the Todoist documentation for supported date formats.

Project*

Add task to an existing project. If no project is selected the task will be added to your inbox. Use either the hashtag notation #project (preferred) or the comma-separated 3rd {project} argument. Project names are case insensitive and (for now) can't contain any whitespace characters.

Labels*

You can add labels to your tasks using the @ character. Label names are case insensitive and can't contain any whitespace characters.

Priority

A number between 1 and 4, where 1 is the lowest and 4 would be the highest priority.

* Relies on node.js to work

Search and Browse Tasks

search-tasks.gif

Alfred command

todos {query}

Query

Any search query one character or longer. Uses fuzzy search to find the tasks.

Example: todos car => returns (because of fuzzy search):

  • Rent car
  • New cat recipe's
  • Cut Gras tomorrow

Configuration

Some magic will happen when you run the t command, like creation of files and refreshing of todoist data cache. Other than that use it to configure the workflow.

Alfred commands

t:token {api token} (no default)
Example: t:token 2d2e2a334c5f36e7a7c43b46e

t:language {language} (default: en)
Example: t:language nl

t:items {max list items} (default: 9)
Example: t:items 9

t:update
Example: t:update

t:node
Example: t:node

Token*

Your Todoist api token, get it from Todoist Preferences => Account => API-token (should be 40 characters)

Language

This is relevant for parsing date strings ('tomorrow @ 9pm', in en). Valid languages are: en, da, pl, zh, ko, de, pt, ja, it, fr, sv, ru, es, nl.

Max Items to Show

This parameter limits the amount of tasks shown when using the todo command. Node.js is required for listing todos

Check for updates

Checks current version against latest online version and download if a newer version is available.

Node.js

Node.js is required for listing todo's. Working with JSON API's in batch is no fun and the JavaScript force is strong in my, yet none of the other forces (ruby, PHP, python etc.) are. If you decide you want this feature there is an install function included. This will install Node.js as well as a package manager called Homebrew to install Node (all other ways of installing node require admin permissions or leave files on your computer). This has the added benefit of making it easy to uninstall as well.

Example: t:nodejs => ENTER

Uninstall Node (terminal):
brew uninstall node

Uninstall Homebrew (terminal):
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"

* Required

Changelog

View CHANGELOG

License

The MIT License (MIT)

Copyright (c) 2017 Martien Oranje

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

 

Edited by Martien Oranje

Share this post


Link to post

Looks handy. The GitHub URL is a 404, unfortunately.

 

A couple of suggestions for possible improvement:
 
It'd be better if you could move the configuration into a separate file. There are standard locations for such files. The reason is that any update to the workflow will overwrite the user's config.

 

The simplest way would perhaps be to add another action that creates the config file if necessary, and then opens it in the user's default editor (open /path/to/config.sh). You could use export TOKEN=xxx in the config file and then source it from your other scripts.
 
⌘+T isn't a great default shortcut: it's what pretty much every application that has tabs uses to create a new one.

Edited by deanishe

Share this post


Link to post

Looks handy. The GitHub URL is a 404, unfortunately.

 

A couple of suggestions for possible improvement:

 

It'd be better if you could move the configuration into a separate file. There are standard locations for such files. The reason is that any update to the workflow will overwrite the user's config.

 

The simplest way would perhaps be to add another action that creates the config file if necessary, and then opens it in the user's default editor (open /path/to/config.sh). You could use export TOKEN=xxx in the config file and then source it from your other scripts.

 

⌘+T isn't a great default shortcut: it's what pretty much every application that has tabs uses to create a new one.

 

Hi, thanks for your feedback!

 

The config options are not ideal, I was looking for a way to make the usage a little friendlier. Good tip on the opening command too. I'm aware of ⌘+T not being ideal (I have added iTerm to the list of related apps that shouldn't have focus), can you recommend something a little more idiomatic to alfred?

 

Will update when I have some more time to invest. I'll fix the github url straight away, nice catch.

 

Martien

Share this post


Link to post

No idea regarding the hotkey. I guess it doesn't really matter, as Alfred strips any hotkeys defined in the workflow on installation (it tries to preserve user-set hotkeys across updates).

Share this post


Link to post
ObjC.import('stdlib');
var dataDir = $.getenv('alfred_workflow_data');

 

Edited by deanishe
Put code in code box

Share this post


Link to post

Did anyone else experience any problems with adding tasks?

 

When I try Alfred says "Task was added to your inbox" but nothing happens. I have added the token which I got from Todoist settings -> account -> API token. 

 

Any ideas of what the issue could be? I am using the free version of the Todoist together with Alfred3

 

Cheers

Share this post


Link to post

I'm facing the exact same issue.

 

I've correctly registred the token, and when I add a task it says "Task was added to your inbox", but nothing appears in my todoist :(

 

NodeJS is also correctly installed through brew.

Share this post


Link to post

Hi guys,

 

I can't reproduce the problem. Adding tasks doesn't require node.js. And since the first release not much has changed to the logic of adding a task, though I can't be a 100% sure a bug hasn't found it's way in. Can you shoot me some more info on:

- Your mac OS versions

- Alfred versions

 

Please check that there are no spaces in the token. Also check 

~/Library/Application Support/Alfred 3/Workflow Data/com.alfred-workflow-todoist

for a file named settings.json (private information!) for anything that looks off there (no token, invalid json formatting, nothing at all). Let me know what you find.

 

Martien

Edited by moranje

Share this post


Link to post

Hi Martien,

 

Thanks for replying :). I am using OSX version 10.11.6 and Alfred v3.0.2.

 

I have tried to reinstall the workflow without any progress. I have not installed the json so I am lacking the folder you refer to, is that correct? I have copied the token and made sure it didn't have any whitespace but it didn't work still.

 

Thanks for the help!

 

/Niklas

Share this post


Link to post

I just installed the json because when I went into the debugger in Alfred I could see that it was complaining. Now Alfred said I successfully installed it but the folder you are referring to in the Library is still missing :/ 

Share this post


Link to post

I'm having the same problem I also don't see folder com.alfred-workflow-todoist in Workflow Data, though I see the settings for my other Alfred workflows :(

Share this post


Link to post

I'm experiencing the same problem. The folder doesn't exist inside Workflow Data.

/Application Support/Alfred 3/Workflow Data/com.alfred-workflow-todoist/settings.json: No such file or directory

I was able to fix it by creating the folder "com.alfred-workflow-todoist" manually and then when I opened the folder the file seemed to appear by itself or possibly after I attempted to add a todo item. Then I opened in text editor and it was missing the token key. Pasted it in there and saved and now it works and is able to add tasks.

 

It seems that there is likely a problem in the configuration of the token whereas I have reinstalled the workflow, the first time I applied the token to the script in the workflow editor and the second time I applied it through the t:token command and it seems neither of these actually apply the token to the settings file. I would assume there is a permission error preventing it from applying these changes.

Edited by etaming

Share this post


Link to post

Updated to version 3.0.0. The significant changes are:

  • You are now able to add a task to an existing project

Ex:  todo Buy milk, tomorrow at 6pm, groceries (groceries being the project)

  • You are now able to add labels to your tasks

Ex: todo Buy milk @diary @white_stuff @food

  • The API changed to accommodate labels and projects, whereas it used to be that you would assign a priority like this:

Ex: todo Buy milk, tomorrow at 6pm, 3

 

You can now achieve the same thing as follows:

 

Ex: todo Buy milk !!3, tomorrow at 6pm, or for that matter like this:  todo Buy milk, tomorrow at 6pm !!3

 

Cheers,

 

Martien

Share this post


Link to post

New version 3.1.0:

[FEATURE] `todos + {query}` (todo search) command added, now you can fuzzy search your tasks.
[FEATURE] caching! Cache is refreshed on hitting `t`. Everything should run a little faster now.
[CHANGE] running `todos` without a query will list your todos (this feature used to be under `todo`)

Share this post


Link to post
Hi Guys

 

I am a relative newbie to Alfred 3 and to Workflows in general.

 

Try as I might however I have simply been unable to get the Todoist workflow to work !!

 

I have obtained my API Token from Todoist , downloaded and installed the latest workflow version.

 

I have then navigated to the workflow in Alfreds “Workflow” section and opened up the initial “t” script filter.

 

I have noted the location on the 4th line where the api token needs to be inserted and have pasted the token into place ensuring no white spaces or gaps.

 

On each attempt I have made to use the workflow I keep receiving the following :

 

Failure

 

Error: Invalid argument value,”command_type”,”item_add”,”error_code”:20,”http_code”:400

 

I have also looked into 

 

~ Library/Application support/Alfred 3/Workflow Data/com.alfred-workflow-todoist

 

and can confirm the existence of the file “settings.json”

 

This file contains the api token details.

 

I would greatly appreciate advise and guidance as to how I may be able to get this workflow configured in order that I can use it.

 

Kind Regards

Paul

Share this post


Link to post

 

Hi Guys
 
I am a relative newbie to Alfred 3 and to Workflows in general.
 
Try as I might however I have simply been unable to get the Todoist workflow to work !!
 
I have obtained my API Token from Todoist , downloaded and installed the latest workflow version.
 
I have then navigated to the workflow in Alfreds “Workflow” section and opened up the initial “t” script filter.
 
I have noted the location on the 4th line where the api token needs to be inserted and have pasted the token into place ensuring no white spaces or gaps.
 
On each attempt I have made to use the workflow I keep receiving the following :
 
Failure
 
Error: Invalid argument value,”command_type”,”item_add”,”error_code”:20,”http_code”:400
 
I have also looked into 
 
~ Library/Application support/Alfred 3/Workflow Data/com.alfred-workflow-todoist
 
and can confirm the existence of the file “settings.json”
 
This file contains the api token details.
 
I would greatly appreciate advise and guidance as to how I may be able to get this workflow configured in order that I can use it.
 
Kind Regards
Paul

 

 

 

I do have the same problem and I cannot find any solution to it. Any help? Many Thanks

 

 

Hi guys,

 

Make sure you have downloaded v3.0.2 and redownload it if you have changed any of the scripts, that's not the intended way.

 

In the Alfred bar, type the following and replace the token with your own. 

t:token 238948934acde892edc989

You should be all set. If you need more instructions, check out the GitHub page.

 

Let me know if you need any more help.

 

Martien

Share this post


Link to post

Hi Martien

 

Thank you for your response.

 

I have removed my old installation , re-downloaded from the Git Hub link provided and re-installed.

 

I note however that the version number is not 3.0.2 but is in fact 3.1.2 in case there is any significance here ??!!

 

I navigated to the "Alfred Bar" where I am able to click on the "Configure workflow and variables" dialogue button and inserted my token details as per the image in the link below ( I have of course pixelated my personal token number)

 

The workflow still returns failures so clearly some issue remains - what am I doing wrong ?

 

Dropbox Image

 

Kind Regards
Paul

Share this post


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
×