I’ve previously mentioned on this blog and on my YouTube channel that Drafts 5 has quickly become my go to app for any text processing task on iOS.

In this post, I’ll show you how I use this fantastic application to process my shopping list. But first, some background.

In my household, my wife is the one who decides what we put on our shopping list. Based on her meal plans and other needs, she comes up with a list of items we need to buy. She then writes this in her task management notebook — a physical notebook, not software — and we shop using that as a guide. Normally, we go shopping together or she does the shopping while I’m at work.

However, we were recently blessed with a new baby, and that has wrecked havoc on the way we normally handle shopping. For the most part now, my wife hands me a list of things to buy and I go buy it — it’s very difficult for her to go shopping on a regular basis, especially when the baby is being fussy.

Initially, I tried getting my wife to enter her shopping list into Todoist, so that we could have a unified place for keeping our shopping list, but that did not work out very well.

My wife feels more comfortable writing a list of items without worrying about the syntax that would place the items into our shopping list on Todoist, and doesn’t want yet another app on her smartphone. The system I describe in this post is one that I came up with to make us both happy — she writes normal lists, and then I process the lists into Todoist and work from that.

The System

The system we came up with, is that my wife writes her shopping list in WhatsApp and sends it to me. Each item in the list is on a separate line. This is a natural way for her to write the shopping list, and doesn’t necessitate installing another app on her phone.

When I receive the WhatsApp message, I immediately copy it’s content and paste it into Drafts 5 for further processing.

What I want to do after pasting into Drafts 5, is to append the word “#shopping” to each line of text and then to send that text to Todoist where it is processed using natural language processing and placed into my shopping list — the “#shopping” tag is what moves it into the shopping list. I’ll now discuss how I experimented with two different methods to do this.

Using Workflow

Drafts 5 allows you to write JavaScript to process the contents of drafts, but I decided to first see if I could do this without writing code.

The easiest way to do this without writing code, is to use the visual editor of Workflow to define a sequence of steps to perform the actions.

I actually found a Todoist action in Workflow that does exactly what I want without the need to modify the text — i.e., no need to add the tag “#shopping”. It just takes a line of text and places it into a Todoist project of my choosing. Below is a screenshot of the workflow I wrote to perform the desired task.

My Shopping Workflow

I then created a custom action from within Drafts 5 that calls this workflow with the content of the current note as its input. It worked pretty well and did exactly what I wanted.

Running this action adds each item in the note to my shopping list on Todoist, but the way Workflow operates is that I’m moved out of Drafts 5 and into Workflow, the script is executed and then I’m moved back to Drafts 5 — all this switching takes time.

So while it does exactly what I want, I found it to be a tad slow. True, it barely takes a second to process, but still, I’m used to faster operations than this. So I decided that I would just write the JavaScript code and be done with it.

The JavaScript Solution

Writing the JavaScript for this task turned out to be very easy. All I had to do was split the text using the newline character as the separator, and then iterate over each line and add “#shopping” to its end. Here is the code:

var d = draft.content;
var lines = d.split("\n");
var n = '';

for (var line of lines) {
 if (line!=""){
    line=line+" #shopping";
    n+=line + "\n";

draft.content = n;

The code is self explanatory, I split the content of the draft into lines in the first two lines of code, and then iterate over the lines adding “#shopping” in the for loop.

Finally, in the last two lines, I update the content of the draft using the modified text. I now have a draft with the tag “#shopping” at the end of each line.

This JavaScript code is the first step of a two-step custom action I defined for handling my shopping list. The second step of this action is to send the now properly labeled text to Todoist’s quick-add API for natural language processing. Once that is done, I have a nice shopping list in Todoist that I can use to guide my shopping.

There is already an action that sends text to Todoist from Drafts, so I used that instead of reinventing the wheel. The action is available in Drafts’s action directory under the name Todoist Quick Add V3 – With Notes, Reminders, and default project. I downloaded the action and used it as the second step of my custom action.


That’s it ladies and gents, that’s how I use Drafts 5 to process my shopping list:

  • my wife sends me a WhatsApp message with the list
  • I paste it into Drafts 5
  • I run the custom action I describe above
  • I go shopping using my newly populated Todoist shopping list

I hope this post gives you an idea about the power of Drafts 5, this is an app that I can’t recommend strongly enough. Give it a try and see how many things you can automate. Until my next post, bye for now.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.