send-sms.js
The library to send simple message which is compatible with multi-services, currently it supports the following services:
- 短信宝(smsbao.com)
- 容联云(www.yuntongxun.com)
Installation
$ npm install send-sms --save
This library also is able to run at browser-side or any JavaScript environment.
Usage
const SMS adapters } = ; const smsbao = user: 'your user from smsbao' pass: 'your pass from smsbao';const sms = 'weflex' smsbao; // when you need to send a simple messagesms; // sms.send returns a Promise so if you are in ES7 environmenttry await sms; catch err console;
The above example will send a message to user like the following:
【weflex】foobar text
Write your adapter for service that you are using
const Adapter = ; { super'your name' // options like credentials ; } { // must implement this method in your self adapter, which does // send requests to service endpoint, and must return a Promise }
To see an example, see 短信宝
License
MIT @ WeFlex, Inc.