Use Twilio and Google Sheets to Create a Baby Name Delivery Service

My wife and I are expecting our second boy in a few months, but we haven’t yet settled on a name for our little kiddo.

Now, my wife has no trouble at all with regularly looking at names, browsing lists, researching meanings of names, etc. In fact, she already has a #1 pick and she’s trying to convince me to agree to it 🙂

The problem

Me, however … I’ve had a hard time settling on a name I love.

And whenever I sit down to research names, this is what happens:

  1. Spend time looking at lists of names
  2. Don’t see anything that I love
  3. Tell myself “We’ve still got plenty of time, I’ll look again later”
  4. Forget (for weeks, months) to actually go back and review more names…
  5. Panic/scramble, realizing that we still need to find a name!
  6. Start over at step 1.

After a few iterations of this panic cycle, I started searching for a tool that could just deliver names to me – something that would take the work out of researching baby names.

But after searching for a while, I was unable to find an app or service that actually did this. Most baby-name websites just host lists of names, and you’ll never see those names unless you go to the websites and scroll through the lists.

Since I couldn’t find a service to do this for me, I decided to build one.

The solution

Enter Twilio and Google Sheets.

Twilio provides a simple framework for custom messaging, and Google Sheets is a great tool for hosting a list online.

Google Sheets even comes built in with a powerful scripting service called Apps Script that allows anyone to automate workflows, perform complex tasks that integrate with external services (like Twilio), and more.

Put together, these two services make the perfect foundation for a simple & personal baby name delivery service.

Here is the general structure of how the service works:

  1. Host a list of baby names in a Google Sheet. Include information about each name, like gender and popularity. This allows you to set up filters so that you only receive the types of names you like.
  2. Create a script using Apps Script that
    • Runs automatically each day
    • Grabs random names from the spreadsheet list
    • Sends a text message with the random names that were chosen

Wait a minute, you’re losing me…

If you already think this sounds way too technical or complicated for you – that’s okay.

Send me a note to say that you’d like to get this set up and I’ll see what I can do to help!

Otherwise: if you’re comfortable playing with spreadsheets and using developer apps like Twilio, let’s dive in to the details of each step!

1. Compile list of baby names into a Google Sheet

The Social Security Administration keeps comprehensive records of the most frequently used baby names each year.

I compiled the 2000 most popular names (for each gender) from 2015 into a spreadsheet, ordered by popularity and gender:

Click here to see the spreadsheet and make a copy.

After opening the spreadsheet, click “File” > “Make a copy“:

Give your sheet a name, and voilà! You’ve now got a spreadsheet with a list of names.

2. Create a Twilio account

Head over to Twilio’s sign up page and create a free account.

I recommend selecting “SMS“, “Other types of SMS alerts” and “JavaScript” in the sign-up form:

After signing up, follow Twilio’s verification steps to activate your account.

3. Plug your Twilio API credentials into the spreadsheet settings

The first step here is getting a Twilio phone number. Twilio will use this as the “sent from” number that delivers your text messages to your device.

You can get your own number here: https://www.twilio.com/console/sms/getting-started/basics

Once you have a number, copy it and paste it into cell I3 of the “Settings” tab of your spreadsheet:

Note: Twilio is smart enough to understand multiple different formats for phone numbers. You should be able to use any of the following:

  • 213-456-7890
  • (213) 456-7890
  • +1213-456-7890
  • +12134567890

If you want use a format that starts with +1, be sure to type a single quote (') in front of the plus sign. I.e.: '+1

If you don’t include the quote mark, Google Sheets will interpret the plus sign as your attempt to do math. The quote mark tells the spreadsheet that you just want to use the literal plus sign in the cell’s value.

Now, go back into Twilio and click on the “Show API Credentials” link in the top right corner of the page:

Copy the Account SID at the top of the page and paste this into cell I4 of the spreadsheet settings.

Next, copy the Auth Token and paste this into cell I5 of the spreadsheet settings.

4. Activate the Apps Script code that powers the service

When you copied the spreadsheet, you also copied the underlying Apps Script code that will power our text message delivery service!

Access this code by clicking “Tools” > “Script editor…” from the main menu:

You do not need to edit any of the code.

What we’ll do instead is turn on one of Apps Script’s most powerful features: triggers.

Triggers allow us to automatically run this code daily, monthly, hourly – on any schedule we like!

Let’s set up our code to run once per day, in the morning:

  1. In the code editor, click “Resources” > “Current project’s triggers“.
  2. Click the “No triggers set up. Click here to add one now.” link.
  3. Choose “Day timer“, and select an hour range that you like.
  4. Click the “Save” button.
  5. When prompted, click “Review Permissions“, and then “Allow“.

That’s it! You’re now set up to receive daily text messages with baby names.

If you’d like to test this immediately:

  1. Enter your phone number (where you want to receive texts) on the “Settings” tab of the spreadsheet in cell F5.
  2. Back in the apps script editor, select the “getNames” function and click the play button, as shown here:

If you correctly entered your Twilio number and API information into the spreadsheet, you should receive a text immediately after clicking the play button!

Customizing the service

If you’d like to receive texts more than once per day, you can set up more triggers. I’ve currently got mine set up to send names three times per day: 8-9am, 11am-noon, and 8-9pm:

The “Settings” spreadsheet tab also offers several customization options:

  • Gender: you can receive names for both genders or for just a single gender
  • Popularity: set a “popularity” range so that you only see names inside that range
  • Length: set min and max lengths for the number of letters in names you receive
  • # Names per text: choose how many names you’d like to receive with each text message
  • Phone numbers: add 1 or 2 phone numbers. These are the numbers that will receive the text messages. I’ve got my number and my wife’s number plugged into our settings. That way we both receive the same names at the same times each day.

Caveats

One thing to note about adding a second phone number: to start, you can only send messages to the number you used when signing up for Twilio.

If you want to send to an additional number (like a spouse’s number), then you will need to add that number as a verified number.

In addition, since you are using the “free trial” version of Twilio, all of your texts will be prefaced with “Sent from your Twilio trial account – “.

If you’d like to get rid of that you can upgrade to a paid account for a $20 one-time fee. The $20 charge will typically buy you over 2,500 text messages.

One last caveat: if you somehow work your way through all names in the spreadsheet that match your criteria on the Settings tab, the service will text you with the following message: “Oops! You’ve gone through all possible names. If you’d like to continue seeing names, please adjust your settings or reset the sheet.”

In that event, simply do one of the following:

  1. Adjust the Popularity and Length settings so that more names can be considered.
  2. Clear all “Yes” values in column D of the “Names” spreadsheet tab (drawback: this will cause you to start seeing names you’ve already seen).
  3. Turn off the script altogether by removing the Apps Script triggers.

Summary

Google Sheets offers many powerful tools for automating workflows and processes, and you can take advantage of its signature Apps Script service to connect to Twilio and get baby name ideas delivered daily.

It’s as easy as copying this example spreadsheet and signing up with Twilio. You’ll be well on your way to finding the perfect name for your kiddo 🙂

If you’d like help implementing this, please reach out and I’ll help guide you through it!

Leave a Reply

Your email address will not be published. Required fields are marked *