Node.js SDK for mengwang sms SOAP.
import Mengwang from 'mengwang';
const mengwang = new Mengwang({
username: '<Your userId>',
userpass: '<Your password>'
});
mengwang.sendSms('13700000000', '我是内容').then((result) => {
console.log(result);
}, (err) => {
console.error(err);
});
$ npm install mengwang
This class is a wrapper for mengwang sms SOAP API
Construct a new mengwang object
options
is an object with the following defaults:
{
wsdl: 'http://61.145.229.29:9006/MWGate/wmgw.asmx?wsdl',
pszSubPort: '*',
debug: false,
logger: () => {}
}
options
's property list as below:
Name | type | Description | Requirement |
---|---|---|---|
wsdl | string | WSDL | optional |
pszSubPort | string | sub port | optional |
username | string | The userId | required |
userpass | string | The password | required |
debug | bool | Debug toggle | optional |
logger | function | A logger handler | optional |
proxy | string | Proxy for someone behind a firewall | optional |
timeout | integer | Timeout for request | optional |
logger
function accept only one argument msg
like
(msg) => {
// do some thing...
}
Name | type | Description | Requirement |
---|---|---|---|
msg | string | Log message | optional |
Send sms content
to mobile
Name | type | Description | Requirement |
---|---|---|---|
mobile | string/array | User's mobile to receive sms | required |
content | string | Token played | required |
MIT License. See the LICENSE
file.