triggerScanner/handler.js
// push a message on SNS. used to push triggered triggers for processing
push a message on SNS. used to push triggered triggers for processing
push a message on SNS . used to push triggered triggers for processing
function alertWorkers(trigger) {
  if (averages) {
    trigger["averages"] = averages;
  }
  if (lastPrice) {
    trigger["lastPrice"] = lastPrice;
  }
  var params = {
    Message: JSON.stringify(trigger),
    MessageStructure: 'raw',
    TopicArn: 'arn:aws:sns:us-east-1:<REDACTED>:WorkAlert'
  };
  sns.publish(params, function(err, data) {
    if (err) {
      console.log(err, err.stack); 
    } else {
      console.log("successfully published: " + JSON.stringify(params));
      deleteTrigger(trigger);
    } 
  });
}
function alertWorkers ( trigger ) { if ( averages ) { trigger [ "averages" ] = averages ; } if ( lastPrice ) { trigger [ "lastPrice" ] = lastPrice ; } var params = { Message : JSON . stringify ( trigger ) , MessageStructure : 'raw' , TopicArn : 'arn:aws:sns:us-east-1:<REDACTED>:WorkAlert' } ; sns . publish ( params , function ( err , data ) { if ( err ) { console . log ( err , err . stack ) ; } else { console . log ( "successfully published: " + JSON . stringify ( params ) ) ; deleteTrigger ( trigger ) ; } } ) ; }
push a message on SNS.
push a message on SNS .
/* required */ // an error occurred // successful response