Skip to content

octopush/octopush-sms-node.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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_WORLD,
    sms_sender: 'onesender'
};

Credit check

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

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

sms.get_credit(function(e, r){
    console.log(r.octopush.credit);
});

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_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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published