My Coke Rewards is a program run by Coca-Cola that allows you to collect and redeem points from Coke products. Ever seen those little codes printed on bottle caps or boxes? Modern advances in alchemy now enable us to transmute those seemingly random characters into rewards like gift cards, movie tickets, and t-shirts (my personal favorite)!
It used to be pretty easy to log in and add codes to your account. Unfortunately, My Coke Rewards recently redesigned their website and made it twice as slow, three times as unreliable, and five times as annoying. Every time you log in, you're assaulted with messages to link your Facebook and Twitter accounts, presumably because people want to post on Facebook and Twitter about My Coke Rewards. Let's be real, who would be lame enough to write anything about such a program? Definitely not me???
In light of their regrettable redesign, I decided to take matters into my own hands and set up a way to automate submission of these codes into their website. The solution I developed allows me to send a text message containing the code and have it redeemed to my account automatically!
I'm using a service called Twilio to provide me with text messaging capabilities. I pay $1/month for a permanent phone number that I can send/receive text messages from for a little less than a penny per message.
On the more technical side of things, I'm using an excellent library called Nightmare.js that allows me to interact with the My Coke Rewards website inside a headless browser. The app runs as a Docker container on a Digital Ocean host and is administered via Dokku.
You can see the source code here.