All Projects → Vonage → Vonage Ruby Sdk

Vonage / Vonage Ruby Sdk

Licence: apache-2.0
Vonage REST API client for Ruby. API support for SMS, Voice, Text-to-Speech, Numbers, Verify (2FA) and more.

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Vonage Ruby Sdk

Vonage Node Sdk
Vonage API client for Node.js. API support for SMS, Voice, Text-to-Speech, Numbers, Verify (2FA) and more.
Stars: ✭ 323 (+59.11%)
Mutual labels:  phone, voice, messaging, sms, two-factor-authentication, text-to-speech
Vonage Python Sdk
Vonage Server SDK for Python. API support for SMS, Voice, Text-to-Speech, Numbers, Verify (2FA) and more.
Stars: ✭ 134 (-33.99%)
Mutual labels:  phone, voice, messaging, sms, two-factor-authentication, text-to-speech
Vonage Php Sdk Core
Vonage REST API client for PHP. API support for SMS, Voice, Text-to-Speech, Numbers, Verify (2FA) and more.
Stars: ✭ 849 (+318.23%)
Mutual labels:  phone, voice, messaging, sms, two-factor-authentication, text-to-speech
Vonage Java Sdk
Vonage Server SDK for Java. API support for SMS, Voice, Text-to-Speech, Numbers, Verify (2FA) and more.
Stars: ✭ 75 (-63.05%)
Mutual labels:  phone, voice, messaging, sms, two-factor-authentication
Vonage Dotnet Sdk
Nexmo REST API client for .NET, ASP.NET, ASP.NET MVC written in C#. API support for SMS, Voice, Text-to-Speech, Numbers, Verify (2FA) and more.
Stars: ✭ 76 (-62.56%)
Mutual labels:  phone, voice, sms, two-factor-authentication
Twilio Csharp
Twilio C#/.NET Helper Library for .NET Framework 3.5+ and supported .NET Core versions
Stars: ✭ 541 (+166.5%)
Mutual labels:  phone, voice, sms
laravel-authy
Rinvex Authy is a simple wrapper for @authy TOTP API, the best rated Two-Factor Authentication service for consumers, simplest 2fa Rest API for developers and a strong authentication platform for the enterprise.
Stars: ✭ 35 (-82.76%)
Mutual labels:  phone, sms, two-factor-authentication
Authy
Rinvex Authy is a simple wrapper for @Authy TOTP API, the best rated Two-Factor Authentication service for consumers, simplest 2fa Rest API for developers and a strong authentication platform for the enterprise.
Stars: ✭ 34 (-83.25%)
Mutual labels:  phone, sms, two-factor-authentication
Twilio Java
A Java library for communicating with the Twilio REST API and generating TwiML.
Stars: ✭ 371 (+82.76%)
Mutual labels:  phone, voice, sms
Telegram Sms
An SMS-forwarding Robot Running on Your Android Device.
Stars: ✭ 641 (+215.76%)
Mutual labels:  phone, sms
Africastalking Java
Official Java SDK
Stars: ✭ 27 (-86.7%)
Mutual labels:  voice, sms
Nexmo Node Code Snippets
NodeJS code examples for using Nexmo
Stars: ✭ 36 (-82.27%)
Mutual labels:  voice, sms
Eddiscovery
Captains log and 3d star map for Elite Dangerous
Stars: ✭ 541 (+166.5%)
Mutual labels:  voice, text-to-speech
Vonage Go Sdk
A lightweight library to help Go users everywhere integrate with the Vonage APIs. Issues and PRs all really welcome!!
Stars: ✭ 38 (-81.28%)
Mutual labels:  voice, sms
Android Java Chat App
Open-source Voice & Video Calling and Text Chat App for Java (Android)
Stars: ✭ 66 (-67.49%)
Mutual labels:  voice, messaging
Android Kotlin Chat App
Open-source Voice & Video Calling and Text Chat App for Kotlin (Android)
Stars: ✭ 76 (-62.56%)
Mutual labels:  voice, messaging
Phone
With a given country and phone number, validate and reformat the mobile phone number to the E.164 standard. The purpose of this is to allow us to send SMS to mobile phones only.
Stars: ✭ 531 (+161.58%)
Mutual labels:  phone, sms
Alan Sdk Pcf
Alan AI Power Apps SDK adds a voice assistant or chatbot to your Microsoft Power Apps project.
Stars: ✭ 128 (-36.95%)
Mutual labels:  voice, text-to-speech
Articulate.js
A jQuery plugin that lets the browser speak to you.
Stars: ✭ 116 (-42.86%)
Mutual labels:  voice, text-to-speech
Talkify
Javascript Text to speech library
Stars: ✭ 132 (-34.98%)
Mutual labels:  voice, text-to-speech

Vonage Server SDK for Ruby

Gem Version Coverage Status codecov

Nexmo is now known as Vonage

This is the Ruby Server SDK for Vonage APIs. To use it you'll need a Vonage account. Sign up for free at vonage.com.

Requirements

Vonage Ruby supports MRI/CRuby (2.5 or newer), JRuby (9.2.x), and Truffleruby.

Installation

To install the Ruby Server SDK using Rubygems:

gem install vonage

Alternatively you can clone the repository:

git clone [email protected]:Vonage/vonage-ruby-sdk.git

Usage

Begin by requiring the Vonage library:

require 'vonage'

Then construct a client object with your key and secret:

client = Vonage::Client.new(api_key: 'YOUR-API-KEY', api_secret: 'YOUR-API-SECRET')

You can now use the client object to call Vonage APIs. For example, to send an SMS:

client.sms.send(from: 'Ruby', to: '447700900000', text: 'Hello world')

For production you can specify the VONAGE_API_KEY and VONAGE_API_SECRET environment variables instead of specifying the key and secret explicitly, keeping your credentials out of source control.

Logging

Use the logger option to specify a logger. For example:

require 'logger'

logger = Logger.new(STDOUT)

client = Vonage::Client.new(logger: logger)

By default the library sets the logger to Rails.logger if it is defined.

To disable logging set the logger to nil.

Overriding the default hosts

To override the default hosts that the SDK uses for HTTP requests, you need to specify the api_host, rest_host or both in the client configuration. For example:

client = Vonage::Client.new(
  api_host: 'api-sg-1.nexmo.com',
  rest_host: 'rest-sg-1.nexmo.com'
)

By default the hosts are set to api.nexmo.com and rest.nexmo.com, respectively.

JWT authentication

To call newer endpoints that support JWT authentication such as the Voice API you'll also need to specify the application_id and private_key options. For example:

client = Vonage::Client.new(application_id: application_id, private_key: private_key)

Both arguments should have string values corresponding to the id and private_key values returned in a "create an application" response. These credentials can be stored in a datastore, in environment variables, on disk outside of source control, or in some kind of key management infrastructure.

By default the library generates a short lived JWT per request. To generate a long lived JWT for multiple requests or to specify JWT claims directly use Vonage::JWT.generate and the token option. For example:

claims = {
  application_id: application_id,
  private_key: 'path/to/private.key',
  nbf: 1483315200,
  ttl: 800
}

token = Vonage::JWT.generate(claims)

client = Vonage::Client.new(token: token)

Documentation for the Vonage Ruby JWT generator gem can be found at https://www.rubydoc.info/github/nexmo/nexmo-jwt-ruby. The documentation outlines all the possible parameters you can use to customize and build a token with.

Webhook signatures

To check webhook signatures you'll also need to specify the signature_secret option. For example:

client = Vonage::Client.new
client.config.signature_secret = 'secret'
client.config.signature_method = 'sha512'

if client.signature.check(request.GET)
  # valid signature
else
  # invalid signature
end

Alternatively you can set the VONAGE_SIGNATURE_SECRET environment variable.

Note: you'll need to contact [email protected] to enable message signing on your account.

Pagination

Vonage APIs paginate list requests. This means that if a collection is requested that is larger than the API default, the API will return the first page of items in the collection. The Ruby SDK provides an auto_advance parameter that will traverse through the pages and return all the results in one response object.

The auto_advance parameter is set to a default of true for the following APIs:

To modify the auto_advance behavior you can specify it in your method:

client.applications.list(auto_advance: false)

NCCO Builder

The Vonage Voice API accepts instructions via JSON objects called NCCOs. Each NCCO can be made up multiple actions that are executed in the order they are written. The Vonage API Developer Portal contains an NCCO Reference with instructions and information on all the parameters possible.

The SDK includes an NCCO builder that you can use to build NCCOs for your Voice API methods.

For example, to build talk and input NCCO actions and then combine them into a single NCCO you would do the following:

talk = Vonage::Voice::Ncco.talk(text: 'Hello World!')
input = Vonage::Voice::Ncco.input(type: ['dtmf'], dtmf: { bargeIn: true })
ncco = Vonage::Voice::Ncco.build(talk, input)

# => [{:action=>"talk", :text=>"Hello World!"}, {:action=>"input", :type=>["dtmf"], :dtmf=>{:bargeIn=>true}}]

Once you have the constructed NCCO you can then use it in a Voice API request:

response = client.voice.create({
  to: [{type: 'phone', number: '14843331234'}],
  from: {type: 'phone', number: '14843335555'},
  ncco: ncco
})

Documentation

Vonage Ruby documentation: https://www.rubydoc.info/github/Vonage/vonage-ruby-sdk

Vonage Ruby code examples: https://github.com/Nexmo/nexmo-ruby-code-snippets

Vonage APIs API reference: https://developer.nexmo.com/api

Frequently Asked Questions

Supported APIs

The following is a list of Vonage APIs and whether the Ruby SDK provides support for them:

API API Release Status Supported?
Account API General Availability
Alerts API General Availability
Application API General Availability
Audit API Beta
Conversation API Beta
Dispatch API Beta
External Accounts API Beta
Media API Beta
Messages API Beta
Number Insight API General Availability
Number Management API General Availability
Pricing API General Availability
Redact API Developer Preview
Reports API Beta
SMS API General Availability
Verify API General Availability
Voice API General Availability

License

This library is released under the Apache 2.0 License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].