Loopback-connector-enviossms
Description
This connector is for consume the REST API of enviossms.com
For more information of the enviossms REST API please read their documentation here.
Requirments
- Node: >=8.11.1
- npm: >=5.6.0
- Loopback: 3.x
Usage
- To use this connector install it with the next command
$ npm install loopback-connector-enviossms --save
- Create your enviossms datasource in
datasource.json
, in the"connector":
property especify the loopback-connector-enviossms. The properties"username":
and"password":
are required to connect with the api rest and consume it.
..."enviossms": ...
- Attach your model to the enviossms datasource in
model-config.json
..."sms": ,...
- Then use it in your model
sms
like this
// sms.js'use strict';const chalk = ; // chalk is optional module { const options = to: '+5493511122334' text: 'My sms text' sms ;}
or in other models
// notifications.js'use strict';const chalk = ; module { Notifications;};
Exposed methods
Name | Params | return | Description |
---|---|---|---|
sendSimpleSms |
options : object with to and text properties |
This method return a Promise , when resolve it returns an array with parsed body response in first place and the raw response in the second place; if it is reject returns an error object. |
This option consumes the /sms/1/text/single endpoint of api.envios.sms using the POST http verb. |
Other methods are in development rigth now.
Contribute
To contribute in this project please read the contributing guide in our github respository (at the moment in development).
Next steps in development
The next steps plained are:
- Adding unit test with mocha and chai frameworks
- Develop other endpoints
GitHub
https://github.com/fukuroo-io/loopback-connector-enviossms