Menu

1 / 2

Sending SMS with Ruby and Twilio

DEV Community·Guilherme Yamakawa de Oliveira·6 months ago
#6fu8YACX
#ruby#twilio#sms#send#photo
Reading 0:00
15s threshold

I had never built an app that needed to send SMS, but our last project at the firm required it. I talked to a friend about it and he told me about Twilio . I did some quick research and found the docs really complete and easy to follow.

For those who don't know Twilio , it's a platform that lets you integrate voice, text messages, video, notifications and other things into your app through an API. Integrations are available in Ruby, Java, .NET, Node.js, PHP, and others.

I'll show how easy it is to send SMS from the Ruby console. Soon I plan to do a screencast on how to implement this in a Ruby on Rails app.

Step 1: Create a Twilio account

When you create the account you get a Trial for running tests:

Step 2: Send the SMS

Install the Twilio gem:

gem install twilio-ruby -v 5.21.2

Enter fullscreen mode

Exit fullscreen mode

Open a Ruby console:

irb

Enter fullscreen mode

Exit fullscreen mode

Inside the console we import the twilio-ruby gem, set up the variables and send a message.

require…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.