Monday, 24 February 2014

Creating DayOne entries from IFTTT recipes using DropBox and Hazel


So IFTTT can automatically add DayOne entries for:
  • Photos taken.
  • Places we go.
  • Weather forecasts.
  • News snippets from RSS feeds.
  • Pretty much anything you can imagine using IFTTT.

How is it going to work?
  • We're going to give IFTTT permission to access DropBox so it can write files.
  • We're going to write a hazel script to look for the IFTT files and create DayOne entries. 

What do we need?

1. Create a "DayOneInbox" folder

Create a DayOneInbox folder in DropBox, this is where IFTTT will drop it's files.

2. Create Hazel rules for "DayOneInbox"

Create a shell script rule for text files:

DATE=`stat -t "__%m/%d/%Y %l:%M%p__" "$FILE" | sed -e 's/.*\"__//g' -e 's/__\".*//g' | tr '[:lower:]' '[:upper:]'`
cat "$FILE" | /usr/local/bin/dayone -d="$DATE" new

Create a shell script rule for images:

DATE=`stat -t "__%m/%d/%Y %l:%M%p__" "$FILE" | sed -e 's/.*\"__//g' -e 's/__\".*//g' | tr '[:lower:]' '[:upper:]'`
/usr/local/bin/dayone -d="$DATE" -p="$FILE" new

You can test this already by dropping images or text files into **DayOneInbox**. Hazel should pick them almost instantly and create DayOne entries.

The beauty of the the rules above is that even if you don't turn your Mac on for a few days, they should be added to DayOne on their creation date.

3. Create IFTTT Recipes

Activate the DropBox Channel in IFTTT. Your IFTTT recipes (whatever they are) should leave text or image files in your DayOneInbox folder.


  1. Hmm. For some reason files that are created in DropBox when the mac is offline they all end up having todays date in DayOne.

    Files with dates in the past that I COPY into DropBox work fine.

  2. What does one do with the dayone CLI utils after downloading them? Install them ... use them ... how?

    1. The DayOne CLI tools need to be installed so that the Hazel bash scripts actions above can use them.

      The last line of each calls /usr/local/bin/dayone (from the CLI tools) to create the entry, either an image or a text one, Hazel itself determines the type with the "if kind is..." test.

  3. This looks pretty nifty, will try it out. Thanks for the tip!

  4. Did you also have a look at similar tools like Sifttter-Redu ( or Slogger ( This saves you from using Hazel and you don't even need to have DayOne installed on the computer these tools are running.

    1. Sounds interesting, might take a look - thanks.

  5. I like this workflow as an addition to SIFTTTER and Slogger. Another step towards journalling my life. Thanks for this workflow!

  6. UPDATE: I've tweaked the scripts (2nd line only) to fix an issue where if the file created by IFTTT had '__' in it then date got scrambled by sed and DayOne imported the file with todays date at 12am.

    Just don't use quotes in the filename mmmkay.

  7. I tried this, and while they both make an entry, the image entry is blank, and the text entry is gibberish. Any idea why?

    1. Odd - if you're getting entries created with the right timestamp then hazel and the scripts are working. There must be an issue with the content of the file.

      Have you got the file types back to front - i.e. creating a text entry with an image or vice versa?

  8. I'm getting shell script errors. Could it be because I have 2 profiles on my computer, my main account and a guest account?
    I know very little about scripting and was trying to figure it out.

    1. I found "non-successful status code: 126" when I finally found the text log file....

    2. Strange. Some things to check:

      1. If you pasted the script into hazel, did any extra line breaks get added (there are 3 lines in the scripts)

      2. Do you have the DayOne CLI tools installed?

      3. If you're up for debugging this try creating a file with the text script fragment in it. Disable your hazel dayOne rules, then run the script by hand on one of the files e.g. with:

      bash $HOME/DropBox/DayOneInbox/your_iftt_text_file.txt

      And then see if you get a useful error now that Hazel is out of the picture.

    3. 1. I did find some line breaks, fixed and still does not work.

      2. I've reinstalled CLI tools multiple times, however today I went to terminal and tried typing a "dayone new" it tells me bad command.

      3. This is a bit beyond my exact technical know how. I created a file on the desktop with the code in it (plain text doc renamed to Ran command line "bash $HOME/DropBox/IFTTT/DayOneInbox/tanyabook_september_21__2014_at_0257pm.txt" in Terminal. Got back "No such file or directory......

      Starting to think I just need to write this off as beyond my abilities.

    4. This kind of thing kind of pre-supposes a familiarity with scripting - sadly.

      If you're still game, one last thing to home in on:-

      The missing "dayone" tool is at least one issue that'll stop this working.

      If you run the command:

      ls -l /usr/local/bin/dayone

      This will show you if the dayone CLI tools have been installed OK, it might be that the install failed for some reason. You should get something like:

      -rwxr-xr-x 1 psidnell staff 381072 4 Aug 2012 /usr/local/bin/dayone

      If it's there but you're getting a "bad command" error when you run it then it might be that your $PATH is messed up in some way. Typing:

      echo $PATH

      Will list all the folders bash will look in to find commands. Mine looks like this:


      Clearly /usr/local/bin is there so my command line is finding the dayone CLI tool OK.

    5. Tried "ls -l /usr/local/bin/dayone" and it gave me a Permission Denied.

    6. I'm wondering if the user account you're using is not an Administrator account. This sounds like something to take up with the DayOne peeps, it looks like their installer might not be setting up the permissions properly.

    7. I'm wondering if the user account you're using is not an Administrator account. This sounds like something to take up with the DayOne peeps, it looks like their installer might not be setting up the permissions properly.

  9. This comment has been removed by the author.