I researched Sleep Cycle and found they did not have an API I could use. I paid the 69 pence for premium to access their online dashboard and found I could access the underlying data. However, this was a very long winded method to retrieving data and wasn’t a sustainable method - if they changed their front-end codebase, I would need to update my script.
I had previously experimented with tools to connect different services, such as IFTTT and loved them!
I noticed that Sleep Cycle syncs its data with Apple iOS health. I wanted to access that data and insert it into my calendar. IFTTT doesn’t directly integrate with iOS Health, so I had to look around for other services that used that data and integrated with IFTTT.
I settled on the Jawbone UP app (although I have never owned a Jawbone device) and used IFTTT, Zapier & Google Calendar to connect everything.
The most difficult issue was getting the data into the correct format for Google Calendar to process. I was almost regretting my decision to not create my own program, but then I remembered Google Sheets.
I wrote a small script to parse the sleep data into the correct format for Google Calendar to process and I was away!
There are several steps to complete the integration process, they are as follows:
Make an IFTTT account.
Create new IFTTT trigger. Using this formula.
Download the UP app.
To test the IFTTT trigger, go into the UP app and Track Sleep for over 2 hours, to force the IFTTT trigger.
Edit the IFTTT Google Sheets Spreadsheet to have the sheets that I have in mine here. Note include 1 value to each sheet row.
Create a new Google Sheet script for the IFTTT spreadsheet and add this script in it.
Now at this point. Your sleep should be automatically tracked and new items post processed and appended to Sheet2. Now to add them to your calendar…
Create a Zapier account (I have a whole new account, just for sleep, as this will run everyday). Use this recipe to append the sleep to your calendar in the correct format.
Test everything works by force adding sleep to UP > 2 hours.
You (hopefully) should see it appear in your Google calendar after the IFTTT trigger happens and Zapier trigger happens (30m max). You can force IFTTT and Zapier triggers to happen by going to the triggers and pressing run.
Google Sheets Script found here.
Google Sheets SpreadSheet found here.
A few months later, I managed to get my hands on a Fitbit Flex and was so happy to find it was MUCH simpler to track my sleep! I simply used this IFTTT trigger and it started logging whenever I slept! However, using Sleep Cycle was an interesting process where I utilised multiple services to achieve a goal. So I’m glad I did it!return home