Skip to content
Node.js client library for smsgate
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples
src
.gitignore
README.md
package.json

README.md

Node.js library for SMS Gate

This library requires a minimum node.js version of 7

Installation

npm install smsgate

Send SMS

const SMSGate = require("smsgate");

//make sure to set the real sms gate url
let gate = new SMSGate.Client('http://localhost:9000/bulk_server')
gate.send({
    "type": "text",
    "auth": { "username": "testuser", "password": "testpassword" },
    "sender": "BulkTest",
    "receiver": "4179123456",
    "dcs": SMSGate.DCS_GSM,
    "text": "This is test message with expected DLR",
    "dlrUrl": "http://localhost:8000/dlr", //make sure to set your real webhook handler url
    "dlrMask": SMSGate.DLR_MASK_STANDARD
}).then(response => {
    console.log("SMS sent", response);
}).catch(error => {
    console.log("SMS error", error);
});

Receive DLRs

//depending if you are using a framework or not, it might vary
//in general raw body payload should be parsed into js object
let dlr =JSON.parse(body);
console.log("DLR received", dlr);

Check examples directory for more details. To run examples locally run from the command line

cd examples
node index.js

and then open http://localhost:8000/

You can’t perform that action at this time.