exotel

1.0.1 • Public • Published

Exotel API helper for node

NPM version

Currently supports:

  • Sending SMS
  • Checking SMS status

More features are coming in. Contributions welcome.

Installation

npm install exotel

Usage

var exotel = require('exotel')({
    id   : // exotel id,
    token: // exotel token
});
 
exotel.sendSMS('9999999999', 'Hi', function (err, res) {
    // ...
});

Documentation

sendSMS(mobile, msg, [statusCallback], callback)

Sends an SMS

Arguments

  • mobile (String): 10-digit mobile number
  • msg (String): Message body
  • [statusCallback] (String): An optional URL to call when the message reaches a terminal state (delivered or failed)
  • callback (Function): Called as callback(err, result) - where result is a JSON version of the Exotel xml response:
{
    Sid        : '<sms_id>',
    DateUpdated: '2014-07-30 09:44:56',
    DateCreated: '2014-07-30 09:44:56',
    DateSent   : '1970-01-01 05:30:00',
    AccountSid : '<account_id>',
    To         : '<recipient_mobile>',
    From       : '/<account_id>',
    Body       : 'Hi!',
    BodyIndex  : '',
    Status     : '<status>', // "queued", "sending", "sent" .. etc.
    Direction  : 'outbound-api',
    Price      : '',
    ApiVersion : '',
    Uri        : '/v1/Accounts/<account_id>/Sms/Messages/<sms_id>'
}

checkSMS(sid, callback)

Check SMS status

Arguments

  • sid (String): Sid in sendSMS result
  • callback (Function): Called as callback(err, result) - where result is the same SMS data as above

Testing

Install dev dependencies and run:

EXOTEL_ID=<id> EXOTEL_TOKEN=<token> MOBILE=<recipient> npm test

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i exotel

Weekly Downloads

12

Version

1.0.1

License

MIT

Last publish

Collaborators

  • ramniquesingh