Giter Site home page Giter Site logo

dabidski / nexmo-ruby Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vonage/vonage-ruby-sdk

0.0 2.0 1.0 247 KB

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

Home Page: https://docs.nexmo.com

Ruby 100.00%

nexmo-ruby's Introduction

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.