Miss any of our Open RFC calls?Watch the recordings here! »

NexmoJS

1.0.0 • Public • Published

NexmoJS

A node implementation of Nexmo REST API written in Coffeescript.

Nexmo is a cloud-based SMS API that lets you send and receive high volume of messages at wholesale rates.

For more information on the API check Nexmo's Nexmo Docs.

How to use

Import

Nexmo = require './nexmo'

Initialize

auth =
	key		: 'INSERT-ACCOUNT-KEY'
	secret	: 'INSERT-ACCOUNT-SECRET'

nexmo = Nexmo.init auth

Configure

simpleSMS = 
	from	: 'Wilhelmbot'
	to		: 528100000000
	text	: 'Greetings from the Matrix'

nexmo.setMessage simpleSMS

Send

nexmo.send (response) ->
	error = response.messages[0]?['error-text']
	balance = response.messages[0]?['remaining-balance']

	if error?
		console.log "Error: #{error}"
	else
		console.log "Message delivered"

	console.log "Remaining balance: #{balance}" if balance?

w00t

Install

npm i NexmoJS

DownloadsWeekly Downloads

3

Version

1.0.0

License

none

Last publish

Collaborators

  • avatar
  • avatar