SMS library

Note Content

Library provides simple functionality for sending and receiving SMS in text mode. This library is singleton, it has only one instance.


var sms = require('sms');

Send SMS

Function sends simple text SMS to phone number.

send (phoneNumber, text);

String phoneNumber - phone number in international format +420456993002

String text - text of message. Text has to be simple with maximal length 160 characters.

Receive SMS

When SMS is coming into modem, function smsReceive(...) will be invoked. Body of this function has to be defined in your code.

smsReceive (from, text, date);

String from - is phone number in international format.

String text - is short text message.

Date date - is time and date when SMS is received.


var sms = require('sms');

//incoming SMS - event from modem has to be processed
sms.smsReceive = function(from, text, date){
    if (from==="+420723616xxx") { //yes, sender's number is equal
        sms.send(from, "Hello Boss!!!");
    } else {
        sms.send(from, "Don't touch me!!!! Grrrr!!!");
//send message
sms.send("+420723616xxx","Hello dude!");

results matching ""

    No results matching ""