Forward incoming SMS messages to email with Node.js, SendGrid and Twilio Functions

Phil Nash on July 27, 2017

If you want to read incoming SMS messages sent to your Twilio number in your email then do I have a neat solution for you today. We're going to use... [Read Full]
markdown guide

Love the simplicity of this solution, but I am not able to get it to work. Could something have changed since you published this article? With everything set I am getting a 11200 - HTTP retrieval failure error every time I send an SMS to my twilio number. Any changes needed to your original post? If it still works for you, what would you need to help point me in the right direction? I am not sure if something changed on Twilio or on Sendgrid. I have quadruple checked the code and don't see any differences from yours.

I appreciate any help you can offer in addition to your very helpful original post!



Oh, this might be because the got module doesn't come installed by default any more. Try going to the config section and adding got to the npm module dependency.


Oh good! Iā€™m out at a conference right now, but I will update this when I get the chance.


Hey Phil, awesome post! This is a great write-up, and really captures the magic of Twilio's platform. For such a long time, SMS felt like it's own black box, but with the API and new Twilio Functions it seems like it's becoming increasingly accessible to leverage that protocol in new and interesting ways.

The metaphor of Twilio Functions as "plumbing" definitely lands -- it's like a more-technical but more-powerful version of Zapier for messaging.

I think that two additional ideas for future example Twilio Functions (and just valuable to use) would be:

  • respond to those same messages from the gMail thread
  • read/respond from Slack (since their mobile app is so solid)

Thanks as always for sharing!


Yes! Another cover image gif! Or just cover gif?

Twilio Functions looks great. I think it'll work for one of my little ideas I had, where my phone sends an automated message if the battery is dead and the message hasn't been delivered. Thanks for the post!


I also get the HTTP retrieval error bur I have the got NPM setup (8.3.1)
HTTPError: Response code 401 (Unauthorized)

Great idea though to forward messages.


Got it working. I changed the version of got to 6.7.1 and it worked. Thanks.

code of conduct - report abuse