lamassu-server/dev/send-message.js
2016-04-22 19:22:34 +03:00

31 lines
649 B
JavaScript

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)
})
})