Resurrecting Google SMS Search Using Twilio

Join the discussion on Hacker News!

Twilio Google SMSLike many of you, I was sad to hear on Friday that Google decided to shut down their service that let you search via SMS. Luckily, a basic version of the service is not difficult to create on your own using Twilio SMS and Google’s Custom Search API!

This is a very bare-bones implementation, but it should provide a decent framework for you to expand it with additional filters and more intelligent queries.

We are going to use Sinatra (my favorite lightweight Ruby web framework), the google-api-client gem, Heroku, and Twilio-Ruby to deploy a basic Google SMS app.

Setting up Custom Search

To begin, we need to go over to the Google API Console and create a new application. Once you have created the application, make sure to enable the Google Custom Search Service, then head to the API Access tab and get your API key. We do not need OAuth 2.0 for this project.

Next we need to create a new Custom Search Engine:

  1. In the Sites to Search field feel free to enter any domain, we will delete it later
  2. Head to the Setup tab under ‘Edit search engine’ – under the Sites to Search dropdown select “Search the entire web but emphasize included sites”
  3. Select the domain name you entered on the list below and Delete it

Now you have a Custom Search Engine that searches the entire web.

Be sure to copy down the CX parameter from your URL – we will be using this later.

Coding the SMS

Now that our setup is complete, we can proceed to the code. For this project, we only have one route – /receivesms. Create a file named app.rb with the following contents:
Make sure you go back in and enter your Google API key on line 7 and your Custom Search Engine ID (CX) on line 15. You’ll also notice that we are only returning the top 3 results at this point, you can customize this number or add additional filters as per the API documentation for Custom Search. To finish up, we will need a Gemfile and a file (to deploy on Heroku)

Then you can deploy this to Heroku or your favorite hosting service, set up your Twilio number’s SMS URL to be – and then you can get back to sending your search queries to Google via SMS!

If you have any questions or comments, feel free to e-mail or tweet @jonmarkgo!

  • jonathan

    I think Google’s issue was declining usage and absence of a business model for sms search. What’s the answer to that.

    • Hey Jonathan, I don’t really have insight into why Google cancelled their SMS search. However, this post was written to give developers their own tools to create alternative solutions. Hopefully it will be of use to people to create new SMS search experiences that can succeed on their own or at least be an awesome personal utility.

  • For those who are are coding disabled, we’ve done the work for you:

    Eric Bryant
    Gnosis Media Group

  • obi

    hi Jonathan, I looking to create sms search for a real estate listing website..but I don’t know how to go about it. do you have any advice how to go about this, not excluding commercially.

    • jonmarkgo

      Hey Obi,
      You could definitely use this tutorial as a starting point. You would need to modify the /receivesms callback to search your database rather than google, and then return the search result to the user by using the TwiML tag.

  • Sir Marivin is similar to what Google had, but with more. You can request pictures, get directions, do general web searches, and other stuff. Text ‘help’ to or go to

  • snowmicro

    services consist of Twilio Application development, Twilio API integration
    for the different SMS, Voice and IVR applications.