Checkvist users: send tasks to your todo list via e-mail

Checkvist logo

Here’s a little script I wrote this afternoon to allow you to add tasks to your Checkvist todo list by e-mailing them to yourself (or having them e-mailed to you!)

The script is written in Python, so you need to have Python installed on your system for it to work. Download the script here.

#!/usr/bin/env python

emailusername=''
emailpassword=''
emailserver='imap.gmail.com'
emailfolder='INBOX'
checkvistlogin='Tasks'
checkvistapikey=''
checklistnumber=0

class Checkvist(object):
	def connect(self,username,apikey):
		self.token=self.post('/auth/login.json', {'username': username, 'remote_key': apikey})

	def addTask(self,checklist,task):
		self.post('/checklists/%s/tasks.json' % checklist, {'task[position]': 1, 'task[content]': task, 'token': self.token})

	def post(self,url,values):
		import urllib2,urllib
		url = 'http://checkvist.com'+url
		req=urllib2.Request(url,urllib.urlencode(values))
		response = urllib2.urlopen(req)
		data = response.read()
		return data.strip('"')

def email_to_checkvist(username,password,server,mailbox,cvusername,apikey,checklist):
	import imaplib,re
	i=imaplib.IMAP4_SSL(server)
	i.login(username,password)
	i.select(mailbox)
	counter=0

	c=Checkvist()
	c.connect(cvusername,apikey)

	typ,data=i.search(None,'UNSEEN')
	for num in data[0].split():
		typ, data = i.fetch(num, '(BODY[TEXT])')
		tasks = data[0][1].split('\n')
		# Mark as read:
		i.store(num, '+FLAGS', '\\Seen')
		for t in tasks:
			if t.startswith('--'): break
			c.addTask(checklist,t.strip())
			counter=counter+1
	return counter

n=email_to_checkvist(emailusername,emailpassword,emailserver,emailfolder,checkvistlogin,checkvistapikey,checklistnumber)
if n>0: print "%d items added"%n

Here’s how I use this:

  1. I set up a gmail filter which looks for any incoming mail sent to my gmail address with +checkvist on the end (a very useful feature of gmail) and archives it, labelling it with ‘Tasks’ in the process.
  2. I installed the script on my server at home, and set up a cron job to execute it every 20 minutes.

When the script runs, it checks my gmail (via IMAP), finds any unread messages in the Tasks label, and converts each line of the messages to a task, which is then added to the top of my checklist. (If a line begins with a double-dash (--), it and any following lines are ignored, so as to avoid including my e-mail signature in my todo list). The message(s) are then marked as read in gmail. Nice and simple.

Once you download the script, you will need to fill in the settings in the first few lines, to include:

  • Your email address and password
  • Your mail server (Gmail’s server is filled in already)
  • The name of the folder (or Gmail label) in which new tasks can be found
  • The username and api key of your Checkvist account
  • The number (find it in the URL) of the checklist you want to add the tasks to.

If you include a due date on the end of the e-mail line, it will be converted as usual by Checkvist.

If you find this useful, please let me know!

Thoughts on Unsheffield

Had my first experience of an unconference this weekend. An interesting event, although not as different to a traditional conference as I was expecting. Continue reading “Thoughts on Unsheffield”

The speed of misinformation

I’ve been following the recent events in Iran on Twitter over the past few days, and have learned the following:

  1. Twitter is a great way to spread information to large numbers of people, very quickly.
  2. Twitter is a great way to spread misinformation to large numbers of people, very quickly.

A couple of examples? Ok.
Continue reading “The speed of misinformation”

Python snippet: check status of your Gmail inbox

Here’s a tiny Python script to check the number of messages (total and unread) in your Gmail inbox.

Continue reading “Python snippet: check status of your Gmail inbox”

Destroy the Earth in 6 easy steps

The nanobots will eat you

A nanobot

Nanotechnology can be scary. And entertaining! This amusing (and really well-made) video (via Boing Boing) tells you how to turn the planet into grey goo in 6 easy steps.

Continue reading “Destroy the Earth in 6 easy steps”

Latest twitter updates...

    RSS Google Buzz

    • Buzz by Martin Brook from Google Reader May 24, 2010
      Station and Shuttle Transit the Sun - Astronomy Picture of the Day RSS Feed - Station and Shuttle Transit the Sun That's no sunspot. On the upper right of the above image of the Sun, the dark patches are actually the International Space Station (ISS) and the Space Shuttle Atlantis on mission STS-132. In the past, many skygazers have spotted the space st […]
    • Buzz by Martin Brook from Google Reader May 15, 2010
      How to Quit Facebook Without Actually Quitting Facebook [Privacy] - Lifehacker - With all the privacy issues surrounding Facebook, many people are considering quitting the site altogether. If you're not ready to take it that far, here's how to avoid the privacy breaches without completely deleting your account and losing touch with your friends. Mo […]
    • Buzz by Martin Brook from Google Reader March 26, 2010
      One day I hope to walk the Pennine Way. But if I never manage it, at least I can experience it the Google way... The Pennine Way - Google Sightseeing - The recent expansion of Street View in the UK allows us to visit sections of the Pennine Way, Britain’s most well known long distance walking path, where we can admire the scenery of three national parks wi […]
    • Buzz by Martin Brook from Buzz March 25, 2010
      So I keep hearing people talking about Ada Lovelace day, but I've only just figured out (today) what it's all about. And it turns out it happened yesterday. The idea of the day is for as many people as possible to write about their 'tech heroine'. It's all about celebrating women in technology. (Ada Lovelace was a pioneer of computin […]
    • Buzz by Martin Brook from Posted via buzz@gmail March 12, 2010
      If an ambulance is stuck in queueing traffic, and the lights ahead are on red - is it OK for cars at the front to go through the red light in order to help the ambulance get moving? […]
    • Buzz by Martin Brook from Martin Brook March 3, 2010
      Checkvist users: send tasks to your todo list via e-mail - Here’s a little script I wrote this afternoon to allow you to add tasks to your Checkvist todo list by e-mailing them to yourself (or having them e-mailed to you!) The script is written in Python, so... […]
    • Buzz by Martin Brook from Buzz March 2, 2010
      I've e-mailed trust.enquiries@bbc.co.uk protesting against the proposed closure of BBC 6 Music. http://news.bbc.co.uk/1/hi/entertainment/8544150.stm […]
    • Buzz by Martin Brook from Buzz February 25, 2010
      Just rang my mobile company to ask them to stop sending me marketing texts. Their response was bizarre: "Switch off phone, take out your SIM card, switch the phone back on and wait 20 minutes, then switch off and put the SIM back". I really can't figure out how that will that stop them sending me text messages. I suspect they are just clueless […]
    • Buzz by Martin Brook from Buzz February 25, 2010
      It's funny how the meaning of the word 'geek' has changed over the years. About ten years ago, I think most people would have considered it a fairly negative term. These days it's more of a badge of honour. Case in point: this buzz from Scoble: http://www.google.com/buzz/111091089527727420853/gJJDZCChewb/If-Im-not-following-you-yet-and-yo […]
    • Buzz by Martin Brook from Buzz February 24, 2010
      Finally got round to trying out Google's Chrome OS from http://chromeos.hexxeh.net/. Works nicely on my netbook - seems pretty fast too. Given that I spend 99% of my time on this machine working in Chrome, should I ditch Ubuntu and install Chrome OS? […]