mirror of https://github.com/IoTcat/coron-lstn.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
385 B
26 lines
385 B
4 years ago
|
|
||
|
|
||
|
var sms = (url) => {
|
||
|
|
||
|
var o = {
|
||
|
send: (to, msg0, msg1) => send(to, msg0, msg1)
|
||
|
};
|
||
|
|
||
|
|
||
|
const request = require('request');
|
||
|
|
||
|
var send = (to, msg0, msg1) => {
|
||
|
return new Promise((resolve, reject) => {
|
||
|
request(url + `?to=${to}&s0=${msg0}&s1=${msg1}&t=${Date.parse(new Date())/1000}`, (err, res, body) => {
|
||
|
resolve(body);
|
||
|
});
|
||
|
});
|
||
|
};
|
||
|
|
||
|
return o;
|
||
|
}
|
||
|
|
||
|
|
||
|
exports.sms = sms;
|
||
|
|