obs-sms-plugin
v0.0.2
Published
obd-sms-plugin is a pomelo plugin for pomelo4obd. It provides sms send and revice service for pomelo4obd.
Downloads
3
Readme
obd-sms-plugin
obd-sms-plugin is a pomelo plugin for pomelo4obd. It provides sms send and revice service for pomelo4obd.
Usage
the sms config use json format. For example:
var smsService = require('obd-sms-plugin');
app.use(smsService, {
"server": {
"port" : "6789",
"path" : "/sms",
"ip" : "*.*.*.*" // to filter illegal ip
},
"sender" : {
"format" : "0",
"sendSmsUrl" : "http://WWW",
"corpinfo" : "0"
},
"crypto" : {
"alg" : "des-ede3-cbc", // or other crypto alg
"secretKey" : "zaqwsaqd"
}
});
//send sms. In obd, we use to send at command.
var smsService = app.get('smsService');
smsService.send({phones: ["131****, 132****"], message : plaintext}, function(err, res) {
if(err) {
//error
} else {
//do something about res
}
});
//receive message from device
smsService.on('message', function(msg) {
var phoneNum = msg.phone;
var content = msg.content;
var date = msg.date;
//do something
});