Skip to content

Nexmo REST API client for Ruby. API support for SMS, Voice, Text-to-Speech, Numbers, Verify (2FA) and more.

Notifications You must be signed in to change notification settings

dabidski/nexmo-ruby

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nexmo

A Ruby wrapper for the Nexmo API.

Installation

$ gem install nexmo

Sending a message

Construct a Nexmo::Client object and use the #send_message method to send a message. For example:

require 'nexmo'

nexmo = Nexmo::Client.new(key: 'YOUR API KEY', secret: 'YOUR API SECRET')

nexmo.send_message(from: 'Ruby', to: 'YOUR NUMBER', text: 'Hello world')

This method call returns the message id if the message was sent successfully, or raises an exception if there was an error. The Nexmo documentation contains a list of error codes which may be useful for debugging exceptions.

Production environment variables

Best practice for storing credentials for external services in production is to use environment variables, as described by 12factor.net/config. Nexmo::Client defaults to extracting the api key/secret it needs from the NEXMO_API_KEY and NEXMO_API_SECRET environment variables if the key/secret options were not specified explicitly.

Troubleshooting

Remember that phone numbers should be specified in international format.

Please report all bugs/issues via the GitHub issue tracker.

About

Nexmo REST API client for Ruby. API support for SMS, Voice, Text-to-Speech, Numbers, Verify (2FA) and more.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%