Send an SMS Message with Ruby in 30 Seconds
Time to read: 1 minute
You’re building a Rails app and you need to send SMS messages. “This could take some time,” you think. Not so! Here’s a video showing how quick it is to get started with Twilio in Ruby:
Video: How To Send SMS In Ruby 30 Seconds
As you can’t copy and paste code from a video, here’s how you’d do it:
Install the Twilio helper library for Ruby.
Open up an IRB session and require the library.
Instantiate a REST client using your account sid and auth token, available in your Twilio account portal.
You’ll now need three things:
- The number you are sending the message to
- The Twilio number you are sending the message from
- The body of the message
Wrap those arguments up in an hash and pass them to the client.messages.create
method.
Then wait for the magic to happen!
We can’t wait to see what you build
You’ve sent an SMS message and now you’re ready to take on the world of communications. Take a look at the Twilio REST API documentation to see what else you can do and the documentation for working with the Ruby helper library. Then check out our tutorials to see some more examples, like: sending SMS notifications, masking phone numbers for user privacy or two factor authentication for user security.
Excited about the possibilities? Then let me know! Drop me Twitter or just give me a shout in the comments below.
Related Posts
Related Resources
Twilio Docs
From APIs to SDKs to sample apps
API reference documentation, SDKs, helper libraries, quickstarts, and tutorials for your language and platform.
Resource Center
The latest ebooks, industry reports, and webinars
Learn from customer engagement experts to improve your own communication.
Ahoy
Twilio's developer community hub
Best practices, code samples, and inspiration to build communications and digital engagement experiences.