add notification plugins

This commit is contained in:
Josh Harvey 2016-04-22 19:22:34 +03:00
parent 7e15308499
commit a8b75ca4d2
7 changed files with 123 additions and 126 deletions

31
dev/send-message.js Normal file
View file

@ -0,0 +1,31 @@
require('es6-promise').polyfill()
var config = require('../lib/config')
var plugins = require('../lib/plugins')
var rand = Math.floor(Math.random() * 1e6)
var rec = {
email: {
toEmail: 'joshmh@gmail.com',
subject: 'Test email ' + rand,
body: 'This is a test email from lamassu-server'
},
sms: {
toNumber: process.argv[2],
body: '[Lamassu] This is a test sms ' + rand
}
}
var db = config.connection
config.loadConfig(db)
.then(function (config) {
plugins.configure(config)
plugins.sendMessage(rec)
.then(function () {
console.log('Success.')
})
.catch(function (err) {
console.log(err.stack)
})
})