Year in Pixel with Journal
Step-by-step guide to setup Journal with IFTTT
Make sure you are on Journal v4.0 or above
Background
Mail from: Keira Kenealy,
Hello so I downloaded your journal app a long time ago I saw the update and updated for about a month it has not been opening I just now saw the warning please please please fix it I love this app but wish I could use it thanks! Is there anyway i can fix it myself? If not when will the fix come out, hope it comes out soon! Love this app thanks for your time
Journal v3 added new calendar feature, analytics, added support for 10 different languages and was re-coded with multi-view SDK. Everything was good for first 30 days. Problem occured when user’s data increased until it was no longer enough to keep it all in memory at a time. Fitbit has 64KB heap size limit, doesn’t have support for any local database engine. In all it is a challenge to scale Journal. All the data is stored on user’s device and that’s how the app is available for free, I don’t have to purchase servers and keep them running. Regardless, I had to find a solution to this issue.
Say hello to IFTTT
IFTTT is a freeware web based service which can be used to automate lot of stuff leveraging Internet of Things. What it means for Journal is whenever you add your day which acts as “trigger”. The information can be communicated with IFTTT where we can create an applet which defines “the action” which would be performed. This action can be add record to google sheets or make a tweet or play certain music based on mood, etc. Google sheets action can help us solve the issue of managing the data for us. Also, this is a “One Time Setup” which can take a couple of minutes but it doesn’t cost you any money. So with that in mind lets get into it.
1) Connect to Journal IFTTT Applet
- Connect Journal applet by going to Journal Google Sheet Logging
- If you are not logged in, please login/ signup to IFTTT account
- Journal Year in Pixel Applet needs Google Sheets and Maker Webook to work
- After clicking connect, you will see IFTTT going to google and will ask for permission “IFTTT wants to access your Google Account” in-order to read/write to Google Sheets on your behalf - Click Allow
- Wait a couple of seconds untill you see “Connected”
- Now you need to copy API key by going to IFTTT Maker Webook
- Click on Setting present at the top right corner
- Copy API KEY which is the last part of the URL. For example:
https://maker.ifttt.com/use/{API-KEY}
- Open Fitbit app on your phone and go to Journal App settings
- Click on API Key and paste/type the key you have copied from the IFTTT website and click save.
- Under IFTTT settings, enable “Send to IFTTT” toggle
2) Setup google sheet template
- Make a copy of Journal Stories google sheet
- Rename to exactly “Journal Stories” for IFTTT to discover.
- You have to create the following folders named exactly “IFTTT”. Then inside that folder create another folder “MakerWebooks”. Then inside that create another folder “mood_log”.
- Move Journal Stoies google sheet inside mood_log folder. Make sure the file is exactly located here “IFTTT/MakerWebooks/mood_log/Journal Stories” for IFTTT to discover properly.
- From the Menu click on Tools > Script Editor. This will open script editor in new tab
- Copy the specific code in your language provided here:
// Sample code for English users
const app = SpreadsheetApp;
const activeSpreadsheet = app.getActiveSpreadsheet();
var activeSheet = activeSpreadsheet.getSheetByName('IFTTT');
var yipSheet = activeSpreadsheet.getSheetByName('Year in Pixels');
function setUpTrigger() {
ScriptApp.newTrigger('updateData')
.forSpreadsheet(activeSpreadsheet)
.onChange()
.create();
}
function updateData(e){
if (e.changeType === "INSERT_ROW"){
const lastRow = activeSheet.getLastRow();
d = new Date(activeSheet.getRange(lastRow, 3).getValue());
let value = 0;
let mood = activeSheet.getRange(lastRow, 2).getValue();
if (mood === "Amazing") value = 7;
else if (mood === "Cool") value = 6;
else if (mood === "Happy") value = 5;
else if (mood === "Normal") value = 4;
else if (mood === "Cursed") value = 3;
else if (mood === "Sad") value = 2;
else if (mood === "Worst") value = 1;
let range = yipSheet.getRange(d.getDate()+2, d.getMonth()+3);
yipSheet.setActiveSelection(range.getA1Notation()).setValue(value);
}
}
- After pasting the code at script editor, click on “Select function” which will open a drop-down and select setUpTrigger
- From the Menu Hit run. A pop-up will appear asking “Authorization required”. Click on Review Permissions
- “Journal wants to access your Google Account”. This is required to listen for insert row event - Click Allow
- From the Menu click on View > Executions. This will open admin panel in new tab
- Then, from the side navigation go to My Triggers
- Make sure “Journal” is present in the list only one time
3) Test everything is working
- Make sure your fitbit watch is connected to Phone
- Open Journal app
- Record your day
- Select your mood
- Select most memorable thing
- Open google sheets and confirm new record automatically inserted
- Explore different sheets to see Year in Pixel
That was it… definitely it takes some time to setup but I hope steps were clear enough. If you still confused please comment below and I would be happy to help. IFTTT is not necessary to use Journal, but I would recommend it as it allows you to persist, analyze and export your data which was not possible before. You can setup custom events to trigger with journal utilizing full power of Internet of Things but that would be another post.
Note: IFTTT is 3rd party service! IFTTT account is subject to their privacy policy.