Gathering social media posts into Day One


Day One is a great journalling application that runs on the Mac, iPad and iPhone. I have been using it since January to write a diary, keep track of my diet, keep track of my exercise and record a few other things.

Sometimes, it is nice to drag items from other sources into Day One. This is possible to do by hand but automating it is better. I have been looking at integrating Twitter and Insta.gram into Day One using IFTTT, a web based tool for triggering actions between web sites. An example of the use of IFTTT is that you can setup a rule to post on Facebook when you post on Twitter.

The integration of Day One with IFTTT is not a new idea at all. The GiftttDy script will do most of the work provided you are prepared to buy Hazel for $28. Hazel is a tool for running scripts or actions on the basis of files appearing in directories.

I used GiftttDy for a couple of days and it does the job. For me, a couple of things were missing:

1. I don’t like the format of the Twitter journal entries

2. I don’t want every Tweet to be imported. For example a blog post like this will be manually added by me in DayOne, so adding any related tweets is not necessary.

3. I couldn’t see how to tag my tweets in GiftttDy

So I set about writing my own scripts to do it. The way it works is exactly the same to GiftttDy. I have an action on IFTTT that saves every tweet to a file on Dropbox in a designated directory. Hazel monitors this directory and runs my script against the text file. The script uses the Day One command line tool to add the entry to Day One.

The Day One command line tool could do with some extra features, but the one that is missing is an option to tag a post. I didn’t have too long to spend on this, but I decided that the best way to proceed was to add a second directory that Hazel monitors. This directory contains details of the new Day One file and I have a script to hack in the tags. This script is truly horrible – it edits an XML file and inserts text in the right place. And this nastiness can simply disappear when a command line option to the tool is added to tags.

Obviously owning the code to the script means that I can format the tweets exactly how I want them. I have some ugly code to tag the tweets. What about my second problem? For this, I use curl and some simply pattern matching on the tweet. I use curl to expand any URLs in the tweet to their actual full versions because usually they are short URLs. Once I have the full versions, I can determine if I want to ignore them on the basis of the URL.

By a similar means, it is possible to add Instagram photographs to Day One – this is even easier than a tweet because IFTTT will write the picture file to a directory with the message in the filename.

My scripts are so ugly I won’t publish them here, but you can contact me if you want to see them. You should probably start with GiftttDy and go from there. I may well start using GiftttDy again if I can work out how to format the messages but one cannot beat a little exercise in programming to stretch the mind.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s