Keeping habits with Monzo, IFTTT and apilio.io
While I'm deliberately not calling them resolutions, I do have some goals this year. One of those is to stay more active by swimming as often as I can. Recently, while thinking about how I could promote that, I had an idea! Could my bank Monzo's integration with IFTTT help?
What I've ended up with is a simple penalty system that runs on a two day cycle. If I don't go swimming on any particular weekday, I get a push notification reminding me to go tomorrow. If after that, I don't go, £2.10 (the cost of a single swim) is moved into a locked "Pot" I can only access later in the year.
Identifying a swim
Fortunately, working out when I've been swimming is easy. Monzo have an IFTTT trigger that runs whenever I make a transaction at a particular merchant. I've set this up with the name of my local swimming pool. Keeping track of this is where apilio.io comes in. I created a boolean variable, and the service gave me a webhook URL that IFTTT could trigger to set it's value. I also created a condition, which checks if that variable is true, which will be useful later. As a final touch, another IFTTT applet is used to send me a notification. This way, I'm confident the swim was logged.
I'd rather not forfeit money, so I implemented a reminder system. This consists of an apilio.io logicblock that is triggered by the IFTTT Date & Time service. It's set to run at the end of Monday, Wednesday, and Friday. The logicblock, which IFTTT ran, calls another IFTTT webhook if the condition is false, which in turn runs an applet that sends a notification.
A day later (at the end of Tuesday, Thursday and Saturday), another applet is triggered by the Date & Time service. This makes a GET request to the webhook URL associated with another apilio.io logicblock.
As you can see, this triggers up to two applets. The first, which is always called, resets the boolean variable by calling back to apilio.io. The second moves the penalty amount into my locked pot, and is only called if the condition evaluated to false.
This was a really fun project, and one that went from start to finish very quickly! Sometimes the best part of programming is when you get excited about something, and can't leave your computer until it's a reality.
If you have any other ideas for this, I'd love to know. I'm also happy to answer any questions about what I've done in the comments below.