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. This was a 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 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!
These are the steps to complete the integration process:
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, dedicated 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.
Months later, I managed to get my hands on a Fitbit Flex and tracking my sleep was MUCH simpler! Use this IFTTT trigger and it starts logging whenever you sleep! Using Sleep Cycle was an interesting process where I utilised services to achieve a goal. I’m glad I did it!return home