executedOrderHandler/handler.js
// push on SNS to invoke any listening lambda functions
push on SNS to invoke any listening lambda functions
push on SNS to invoke any listening lambda functions
function submitTriggerToSNS(trigger, callback) {
  var params = {
    Message: JSON.stringify(trigger),
    MessageStructure: 'raw',
    TopicArn: 'arn:aws:sns:us-east-1:<REDACTED>:AlertTriggerRegister'
  };
  sns.publish(params, function(err, data) {
    if (err) console.log(err, err.stack); 
    else {
      const msg = "successfully published: " + JSON.stringify(params);
      console.log(msg);
      const response = {
        statusCode: 200,
        body: JSON.stringify({
          message: msg
        }),
      };
      callback(null, response);
    } 
  });
}
function submitTriggerToSNS ( trigger , callback ) { var params = { Message : JSON . stringify ( trigger ) , MessageStructure : 'raw' , TopicArn : 'arn:aws:sns:us-east-1:<REDACTED>:AlertTriggerRegister' } ; sns . publish ( params , function ( err , data ) { if ( err ) console . log ( err , err . stack ) ; else { const msg = "successfully published: " + JSON . stringify ( params ) ; console . log ( msg ) ; const response = { statusCode : 200 , body : JSON . stringify ( { message : msg } ) , } ; callback ( null , response ) ; } } ) ; }
push on SNS to invoke any listening lambda functions
push on SNS to invoke any listening lambda functions
//push on SNS /* required */ // an error occurred // successful response