Use Google Sheets to log your life by texting it Emojis and pulling in data from Fitbit automatically.
The driving philosophy behind this is finding the path of least resistance to life logging. Pull as much data as possible from other passive tracking sources, like Fitbit, automatically. Make it easy as fuck to update the spreadsheet... single-character text messages ☕️
. No apps to install. Use Google Sheets because they are easy and you probably already have a Google account.
Make sure you have Node 7 or later installed (it needs to support ES6). Sorry... this is kind of a pain to set up. OAuth 2 isn't much fun.
yarn install
or npm install
yarn global install
or npm install -g
to install the command line tool
- Create a Google Sheets spreadsheet. Create a header row with column names. Make sure one of them is called "Date".
- Grab the spreadsheet ID and worksheet ID. Google how to find those on your own.
- Go to https://console.google.com and create an app. Follow instructions here to get your auth credentials.
- Copy
sample.env
to.env
. - Copy
emoji-map.sample.json
toemoji-map.json
. Edit it so that the column names match the columns in your spreadsheet. Add all the columns you want. Removing columns might break things because it expects certain columns to exist for the Fitbit stuff. Sorry about that. - Set up an account on Twilio. Register a phone number with them. Set it up to receive texts. Get your auth credentials and put it in the
.env
file. - Run
middleman.js
on a public IP address. I recommend using Gomix.com for this - just copy and paste the code on there and update the callback URL. This will receive SMS messages from Twilio and then proxy them toserver.js
via a socket.io connection as JSON objects. Once you've done that, updateMIDDLEMAN_URL
in your.env
file with the location of yourmiddleman.js
server. - Set up an application on https://dev.fitbit.com with the Authorization flow. Go to
http://<where ever your middleman.js script is hosted>/fitbit/auth
. Grab the code that it returns and put it in your.env
file asFITBIT_AUTH_CODE
. Also updateFITBIT_CLIENT_ID
andFITBIT_CLIENT_SECRET
which you can get from Fitbit. - Run
server.js
anywhere you want. This will open a connection (via socket.io) to themiddleman.js
server and listen for SMS events. Themiddleman.js
script will proxy SMS events from Twilio to the server. This allows you to run the server and develop behind a firewall or on a private network.
Try sending a text message to the phone number you registered with Twilio... perhaps try ☕️
. This should update your spreadsheet.
Since you installed this package globally (-g
or global
), you can use the command lifebot
to pull in the latest Fitbit data for today. You can specify a different day by adding a date, lifebot 2017-01-22
. Or you can specify a range of dates lifebot 2017-01-01 2017-01-22
. The dates don't have to be in order.
This allows you to update days retroactively. You shouldn't actually need to use this because the server will do this every day automatically at the time specified in your .env
file.