As I get closer to releasing CalQuest to the app stores, this past month has felt like an endless cycle of building new features and fixing the bugs that came from adding those features. Needless to say, that’s 100% normal when building any kind of application, I’m just ranting.
This past week was spent building out the notification system for my app CalQuest. And this was a feature i’ve been looking forward to building from when I build the first page of this app. But why?
I’m really tired of seeing apps send out generic notification that feels like it was batch sent and my device notification token was just part of a long list of tokens. It doesn’t feel intentional. And that’s what I’m trying to do differently with CalQuest, I’ve worked on building a notification system that is intentional, it takes into consideration, patterns, your recent activities on the app and timing. which to me, is a no brainer for an app that’s supposed to helps you build good dieting habits.
From the clients POV, they receive a well-timed, intentional, and good-looking notification, but behind that there is quite a lot technicality that goes into making that happen.
Just to share a brief high level explanation of how that works: Each notification can either be triggered by an activity or be time based(scheduled). Implementing those two individually are very straight forward, but where it gets tricky is when you try to combine both to create a personalized notification experience. For example I want to send a user a notification when it’s dinner time at their local timezone but only if the user haven’t logged a meal in the last 1-3 hours, and if they have, also take into consideration how much they’ve eaten and what their daily calorie cap is (so you don’t notify them to over eat). Then with that information, we send the user a personalized notification. And that’s just the basic logic.
But it also goes deeper when you consider the users logging patterns, for example, if a user consistently logs their dinner at 7pm, sending them a notification around that time increase they chances they will engage. that also helps them builds routine. That scenario I just went through requires a well thought out technical approach and quite a lot of logical decision making to not only time the notification as close to perfect, but also taking into consideration cases that apply to each specific user.
My Technical approach: Cron Jobs and Lambda functions (a lot of cron jobs!!!)
The 3 main section of my app that requires notification are the calories/nutrient tracking, Fasting and hydration.
Let’s get the easy one out of the way, Fasting. With fasting the approach is very simple, the user has a set amount of time they need to fast for, let’s say for this scenario they’re meant to fast for 18 hours. When they click start fasting, right there in the app, it schedules 2 notifications, a half way notification and a final notification, the halfway notification notifies them when they are halfway to completing their fast (the goal is to motivate them) and the final notification is sent when the fast is supposed to be over. And let say the user absolutely needed to eat and ends the fast before the scheduled end time, that action automatically deletes the final notification. really straight forward, nothing too complicated.
On the other hand the calories/nutrient and Hydration tracking utilizes a lot of cron jobs that calls a couple of lambda functions. These cron jobs run at different intervals, some by minuets, hours or days, and in one unique case, by month(this is for sending monthly reviews). The only job of these cron jobs (no pun intended) are to call a set of lambda functions at their set intervals, once those cron jobs make the calls, the lambda functions handle all the logic that determines if the user gets a notification and what the content of the notification will be. i can’t go into all the details of what those lambda functions does or how they work but that’s just my technical approach.
But yeah, this is what I’ve been up to for the past week and I’m really looking forward to when I’ll be able to launch this to the app stores for you guys to use!
If you read to this point thank you, I just realized how long this post was but I’m not going to cut it because I feel it’s information someone might find useful lol.
Thanks for reading.
Levi.
Here's a youtube video i made talking about the app, also subscribe if you're a SWE, i make a lot of SWE content :)
Comments