Send an SMS Using Ruby

Share on Facebook0Tweet about this on TwitterShare on LinkedIn0Share on Google+0

The TextMagic API Ruby wrapper can save you a lot of time, as it includes all the necessary API commands and tests. It only takes a few seconds to download it from GitHub and to install it into your own app or software. After installation, you’ll then be able to send text messages.

Get it now on GitHub

Installation Instructions

Quick Installation

Run the following command to install the TextMagic Ruby helper using gem:

gem install textmagic-ruby

Manual Installation

You can also install the TextMagic Ruby helper from the Github repository using git. Run the following commands:

git clone git@github.com:textmagic/textmagic-rest-ruby.git
cd textmagic-rest-ruby
make test-install
make install

Requirements

The Ruby wrapper for the TextMagic API has the following requirements:

  • Ruby >= 1.9.3
  • Bundler >=1.10

Sending an SMS using Ruby (an example)

Below you’ll find an example of how to send a text message using Ruby.

require 'rubygems'
require 'textmagic-ruby'
 
username = 'your_textmagic_username'
token = 'your_textmagic_apiv2_key'
 
client = Textmagic::REST::Client.new username, token
 
 
params = {:phones => '999000000', :text => 'Hello from TextMagic Ruby.'}
message = client.messages.create(params)

Support

If you need help with the wrapper, or if you have any suggestions for improvements and/or if you have any enquiries regarding the Ruby SMS API, please contact us by emailing support@textmagic.com.