Install
$ npm install jsreactor-channel-sendgrid @coderofsalvation/jsreactor
then include it as usual:
var BRE = require('jsreactor')
var b = BRE(/* myBackendAdapter */ )
var inputChannel = require('jsreactor/channel/Input)
var sendgridChannel = require('jsreactor-channel-sendgrid')
new inputChannel(b)
new sendgridChannel(b)
b.init() // first init
b.run({email:"foo@flop.com"}) // data will be passed thru the business rules engine
// and conditionally triggers actions
Environment vars
- SENDGRID_API_KEY=l2k3l2k3 (see sendgrid)
- SENDGRID_FROM=my@company.com (default from-address)
- SENDGRID_TEMPLATE=lk3l3-lk34 (default template)
Notes
If you want to send attachements just pass {email:"foo@flop.com",attachments:[]}
(see docs for attachment-format)