DEV Community

Estefania Flores
Estefania Flores

Posted on

DIY Cheesy Pickup Line and Twilio

Hey guys and welcome back to my channel! Just kidding, that’s not what this is, I just don’t know how to start a blog. I’m not even a YouTuber.

Anyway, a few months ago, I decided to participate in my company’s incentives for our health insurance. I made an appointment for a regular physical --- what’s wrong with a little extra cash and making sure everything is still running like a well-oiled machine?

The day before my physical, I get a text to confirm my appointment with my PCP. Select one to confirm. This got me thinking about how these sms messages are procured and sent.
While I was scrolling through the interweb and it’s vast indexes of information, I came across Twilio.

Twilio is a straightforward and fun way for businesses to communicate with their members in ways that makes sense for them. Twilio has sms, voice and video options. With a little fun and engaging “how-to” Twilio has quests to teach you how to use their product. I selected a phone number I wanted my messages to come from and I was off to the races. I started my first quest: voice functionality. (Let me preface this with the fact that I have random song lyrics coursing through my head constantly.) Several options on languages makes it easy for companies with national and international users. I chose English and with an English accent, just to make my selection a little more classy. For whatever reason, the first thing that pops into my head is Iggy Azalea’s, “First things first, I’m the realest.” I call the phone number that I had selected and I hear an automated voice saying the lyrics. I’m stoked; super painless tutorial and I got my XP in the quest.

The second quest in the Twilio tutorials consists of implementing a dog facts API and receive a random dog fact when you text the phone number you chose. After doing the Random Dog Fact tutorial, I decide I’m ready to spread my wings and fly and write my own function. I think about some things you could get in a text message and settle on pickup lines. Who doesn’t like a cheesy pickup line? But I know I will need to build an API for this like in the Dog Facts Tutorial.

I decide to use Sinatra, a micro-framework built with Ruby to help make writing API simple and achievable. My first time using Sinatra, I follow another tutorial to make a quick API. I get stuck, multiple times. Can we just take a little break from this to talk about how true that saying about giving up is? Thomas Edison said, “Many of life’s failures are people who did not realize how close they were to success when they gave up.” I pushed through, finished writing the API. I chose to copy and paste a few pick up lines I found online since I don’t have that many up my sleeve. I paste them into a text file and add a route. Everything is great and working till it wasn’t.

Since this is a leisurely project, I chose to stick with Heroku it’s free and easy, like pushing to Github. Of course I get an error because I am missing a file, thanks logs for letting me know exactly what I’m missing. Add the file and do a quick bundle command. IT WORKS.

Now that I have it on Heroku, I’m feeling great; let’s finish this and get those pick up lines in texts. I quickly add the route to my brand new API, feeling great. I forgot Heroku, since it is free, has some downtime when it doesn’t operate. It doesn’t work, I’m not done. Since I forgot, I get annoyed and am changing a little bit of everything because obviously, what I assumed was correct was not. I decide to take a step back because I need a break and it’s late, past my bedtime.

I have dreams about what I need to fix and I see myself coming up with a solution that makes sense. I think about it all day at work and can’t wait to get back home to resolve it. When I get home and open my computer, I started doing a little more research for other options because I can’t be the only one dealing with this right? I come across a Twilio tutorial on YouTube and say, “Duh it’s their product, of course they know what to do.” I changed everything in my original code and it still doesn’t work. Weird. I had to phone in a friend. It took me awhile to realize this, but I love processing outloud. I get stuck, and explaining things to other people the way things work and what I am expecting as an outcome helps the fog to clear up for me.

I call my brother in law, my go-to for all my coding issues (and ceiling fan installations, but we’ll save that for another time). We end up going to the original code and talk about why and how it couldn’t work because it made sense. We try it again and IT WORKS. One more test run, just in case. I can confirm when I get a lame pick up line to my phone when I text 1 to the Twilio phone number.

I am pretty proud of myself for not giving up and completing the goal I set for myself, this blog post included. I love showing people what I did, not only to prove I can do cool things like build a random pick up line SMS project but because I hope people realize they can do it too as long as they don’t quit. Who knows you could end up learning a little bit about yourself, like how I learned how hilarious I think cheesy pick up lines are.

Top comments (1)