1.0.2 • Published 8 years ago

octopush v1.0.2

Weekly downloads
37
License
ISC
Repository
-
Last release
8 years ago

Octopush API library for Node.js

Build Status

A Node.js library for Octopush API.

Octopush offers a solution that was built in-house as a hosted service (SaaS, Software as a Service and an API) to allow marketing departments of major groups, advertising agencies and IT companies to enjoy an infrastructure that supports sending SMS messages to more than 200 countries.

Installation

Installation via npm

npm install octopush

Usage

Config file (config.js)

var octopush = require('octopush');

module.exports = {
    user_login: '************@********',
    api_key: '****************',
    sms_recipients: ['+33600000000'],
    sms_text: 'test text ' + (new Date()).getYear() + '-' + ((new Date()).getMonth() + 1) + '-' + (new Date()).getDay(),
    sms_type: octopush.constants.SMS_PREMIUM,
    sms_mode: octopush.constants.INSTANTANE,
    sms_sender: 'Octopush'
};

Balance check

var octopush = require('octopush');
var config = require('./config.js');

var sms = new octopush.SMS(config.user_login, config.api_key);

sms.get_balance(function(e, r){
    console.log(r.octopush.balance);
});

SMS sending

var octopush = require('octopush');
var config = require('./config.js');

var sms = new octopush.SMS(config.user_login, config.api_key);

sms.set_sms_text(config.sms_text);
sms.set_sms_recipients(config.sms_recipients);
sms.set_sms_type(config.sms_type);
sms.set_sms_mode(config.sms_mode);
sms.set_sms_sender(config.sms_sender);
sms.set_sms_request_id(sms.uniqid());

sms.send(function(e, r){
    if(e) {
        console.log('Error:', r);
    } else {
        console.log('Success:', JSON.stringify(r));
    }
});

More examples can be found in Simple Examples and Advanced Examples.

Requirements

Documentation

This library is completely documented using JSDoc and will show autocompletions in all editors that supports it. Alternatively you can build HTML version of documentation via jsdoc tool.

API documentation available on Octopush API documentation portal.