Socket
Book a DemoInstallSign in
Socket

aspsms

Package Overview
Dependencies
Maintainers
0
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aspsms

Send SMS text messages through aspsms.com

latest
Source
npmnpm
Version
0.1.1
Version published
Weekly downloads
0
-100%
Maintainers
0
Weekly downloads
 
Created
Source

node-aspsms

A partial implementation of the aspsms.com XML SMS API for node.js.

Installation

sudo npm install aspsms

Methods

  • setDefaultOptions(options) Sets the default options
  • send(options, callback, message) Sends a text message
  • showCredits(options, callback, message) Returns the amount of credits left

Options

  • userkey Your ASPSMS Uesrkey
  • password Your ASPSMS password
  • originator Name of the sender
  • recipient Mobile phone number of the recipient

Errors

If the operation was successfull the error object passed to the callback will be null. If the operation fails the error object will contain an errorCode and an errorDescription field with values according to the aspsms.com documentation.

Examples

Send a text message

var aspsms = require('aspsms');

aspsms.setDefaultOptions({
	'userkey' : 'YOUR_ASPSMS_USERKEY', 
	'password' : 'YOUR_ASPSMS_PASSWORD', 
	'originator' : 'TestApp'
});

aspsms.send({
	'recipient' : '+41555123456'

}, function (error) {
	if (!error) {
		console.log('Success!');
	}
	
}, 'Hello, this is a test.');

Show how many credits you have left

var aspsms = require('aspsms');

aspsms.setDefaultOptions({
	'userkey' : 'YOUR_ASPSMS_USERKEY', 
	'password' : 'YOUR_ASPSMS_PASSWORD', 
});

aspsms.showCredits({ }, function (error, credits) {
	if (!error) {
		console.log('You have ' + credits + ' left');
	}
	
});

If you don't want to use setDefaultOptions you can pass all options in each command.

var aspsms = require('aspsms');

aspsms.send({
	'userkey' : 'YOUR_ASPSMS_USERKEY', 
	'password' : 'YOUR_ASPSMS_PASSWORD', 
	'originator' : 'TestApp', 
	'recipient' : '+41555123456'

}, function (error) {
	if (!error) {
		console.log('Success!');
	}
	
}, 'Hello, this is a test.');

Keywords

sms

FAQs

Package last updated on 01 May 2011

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts