messenger-wps v0.0.6
Messenger-wps
Messenger-wps is an integrated platform for dev team in wps to send email or text message freely.(On local server)
var messenger, options;
messenger = require('messenger-wps');
//Setup the email content
options = {
type: 'email', // required
receivers: ['leolai930603@gmail.com', 'leolai930603@sina.com'], // required
text: 'Have fun!', // required
subject: 'Whatever'
};
//The only one function/method at this moment
messenger.sendMessage(options, function(error, msg) {
if (error) {
console.log(error);
} else {
console.log(msg);
}
});
Getting Started
Messenger-wps is a platform for dev team to send email and text message easily with their own server.
Install Messenger-wps
$ npm install messenger-wps
Change server.config.js file
The server address is set to your localhost by default, it is the only one option can be adjusted so far, when you try to expand your notification system, you are allowed to customize your own server configuration.
serverSetting = {
address: 'http://your-server-address/your-restful-api'
};
Require messenger service
Once you finished installation, you can start using messenger service immediately.
messenger = require('messenger-wps')
Send an email
The only one service provided by us currently, we will upgrade this platform step by step in future.
messenger.sendMessage(options, function(error, msg) {
if (error) {
console.log(error);
} else {
console.log(msg);
}
});
About mail options
The options of an email include type ('email' is the only one choice accepted here, we may accept 'textmessage' in future.), receivers (An array of several addresses), text (the content body of your email). The above three items are required in the sending process, which will not be set to some default value automatically. (Attachment function is not supported yet, please attach your resource url in the text)
var options = {
type: String,
receivers: [], //Like ['XXXXXXX@gmail.com', 'XXXXXXX@hotmail.com']
text: String,
subject: String,
bcc: [], //Like ['XXXXXXX@gmail.com', 'XXXXXXX@hotmail.com']
cc: [], //Like ['XXXXXXX@gmail.com', 'XXXXXXX@hotmail.com']
attachment: Object
}