Back to Home

Virtual Valentines

Published on

Project

Virtual valentines! As it appears to be the case for 2021 under lockdown restrictions.

As unfortunate as this is, I still decided that it could be fun to do a Valentine's themed programming project, as a gift for my amazing girlfriend!

This is a very simple project, yet still a great way to add an additional gift for Valentines.

The project: SMS text message love spammer. Not sure how to word it, but essentially, this is just like a spam bot, but instead of promoting products or viruses, it is sharing cute love messages.

I shall give a quick rundown, of how you can implement this, but I will also share my source code for the project. valentines-automation First step: Creating a Twilio trial account, twilio is a communications service that provides simple to use APIs for sending communications. These could be SMS, Emails, Whatsapp messages etc. For this project, I opted to use SMS messaging, as I found out that whatsapp has a pretty strict policy around creating any sort of bots, and have shown to ban accounts. I use my whatsapp a lot, and would rather not get my whatsapp account banned. Twilio does provide whatsapp messaging, however only via Whatsapp approved templates, I am not sending my girlfriend invoices, I'm sending just regular messages, so this would not be applicable.

Follow these guides to help understand the API. https://www.twilio.com/docs/sms.

Second Step: Install required dependencies for the API, and verify your account details via environment variables to plug in the secrets.

At this stage you can test out the API by sending regular messages, to your own phone number.

Third Step: Writing the love messages! If you are real lazy, you can probably find some generic messages on the internet, but that is not what love is about. You really should write meaningful messages that apply to your own relationship.

Fourth Step: Applying automation, I used node-cron, a cron-tab library to be able to execute my program once every 15 minutes. So every 15 mins from Midnight-Midnight a new message would be sent to my girlfriend. You can check out how you can craft your own schedule through this helpful site: https://crontab.guru/ Now just run the program! See? Fairly simple, but still quite a fun project, and definitely a cute project for valentines!

Well, hopefully next year there will not be another virtual valentines.