Saving time through automatic notifications

I share my mobile plan with a few friends and family members (I maxed out the number of lines allowed by my carrier :D). Every month when the bill gets generated, I go to a Google Spreadsheet and update it with the dues for each person. Then I copy that table into an email and send it to our Google Group. This has been going on for over 24 months now. More often than not, some people say these emails are either going to Spam or they are getting crushed under a pile of updates from mailing lists. Or sometimes people just forget, after all, this is a minor thing to worry about compared to numerous other things going on in their lives. This adds another job to my routine - reminding them to clear the dues.

I have been busy with various things for the past couple of months and this task of following up with individuals sunk to the bottom of my priority list. But I had to do this at some point to get paid. So, that's the inspiration for what I did over the weekend.

I was exploring Google Cloud Functions and it seemed to be a great way to get this simple task done without the overhead of traditional compute instances. All I had to do was perform a simple task, nothing else. Immediately I enabled Google Sheets API in my console and got started to query for the values from my spreadsheet. It was super easy and straight forward. I have to say, the official Google documentation on the Sheets API is pretty good for what I was trying to accomplish. Moving on, I had to figure out a way to reliably send a message to the members in my family plan. At first I thought about the Email to SMS gateway service offered by the carriers. It is easy to implement as well since we all were on the same carrier (family plan, duh!), however, when I tried it out, some phones were receiving the text message as MMS and are unable to download that message. I quickly realized that this is not reliable since a client side setting could mess-up the whole point of notifications. SMS is the only universal messaging platform that all of my friends and family use. So I had to rely on some SMS gateway to deliver the message for me.

This is where Bandwidth comes into play. They offer a wide variety of voice and messaging services on their own IP network. I signed up for their free trial, bought a number ($0.35/mo) and setup the API calls in the cloud function. Boom! There goes the notifications ($0.0055/SMS). The cost involved is totally affordable and justifies the time saved avoiding the manual chore.

Protecting the cloud function HTTPS endpoint from unauthorized is the next step. I had to make sure that a direct GET call to the endpoint doesn't trigger the whole workflow and send out SMS to people causing annoyance. A simple solution came to my mind. Validate each request with an authentication token. This means each request to the endpoint will need a token to be present to be accepted before further processing.

After the initial notification upon bill generation, a cron job on the server hosting this website runs after 15 days to remind those people who haven't paid up. Problem solved :)

Yugandhar Veeramachaneni

DevOps engineer and a tinkerer. Co-founded Amaravati Internet Exchange. Passionate about programming, web technologies, internet, security and privacy.

Dallas, TX, USA https://yugandhar.me