With the New Year fast approaching, you, like me, may be considering your goals for the upcoming year. For me, the hardest part about goals is remembering them. I’ll often make them and forget I did. So rather than buy echinacea, I decided to write a hack!

The hack, which I’m calling Daily Goals, emails you every day with a selection of your goals for personal growth. It’s written in Ruby and relies on Iron.io to run it every day.

The Code

All the code you need to get this working is on GitHub. I’ll highlight the key lines with links below.

I decided to keep my goals in a spreadsheet in Google Drive so that I can easily change them as I need to. Luckily, there’s a gem to interact with the service. Using this gem we can log into Google, grab the spreadsheet, and read the list of goals. From there we select a random goal from each category. Once we have our goals from Google, all that’s left is to throw it into a nice email and send it off with SendGrid.

Use the Code

Since the code is already written, we just need to create a Google Spreadsheet and get Iron.io to run it every day.

First, create a Google Spreadsheet. In the first row, put the categories for your goals (e.g. Personal, Professional). In subsequent rows, simply list the goals you have (ex). Save the document and make note of the key parameter in the URL–you’ll need this later.

To get Iron.io up and running we’ll need to clone the repository and start interacting with it.

git clone https://github.com/nquinlan/daily-goals.git daily-goals
cd daily-goals

Then we’ll need to create a new project in Iron.io. Log in to the dashboard and click “New Project.” Name your project and hit “create.”

Once it’s been created, download your credentials as an iron.json file. Move the file to the cloned repository.

Next, we’ll need to upload this to Iron.io and, assuming you have the IronWorker CLI installed, this is relatively simple. The CLI will take a bunch of information from the .worker file in the repository and then make the code through Iron.io. Note: as it’s a “remote” build, it will take a long time to build.

iron_worker upload DailyGoal

Finally, we’ll schedule code to run. To do this, open the IronWorker interface. Go to the scheduled tasks pane and create a new task. Schedule it to run daily (at whatever time you want to receive the email), in the area for “Payload” put a JSON document with your credentials and settings (your spreadsheet key and email) a sample can be found in the repository.

Congratulations! You’re done, a selection of your goals will now be emailed to you daily. If you’d like additional information more can be found on Github.

SendGrid Team
Expert advice and insight about all things email including best practices tips, examples, and advice for marketers, developers, and everyone in between.