auths
objectreturn
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps) => {
}
this.msg = JSON.parse(event.body.Message)
this.notificationType = this.msg.notificationType
let details = "See event for details"
if (this.notificationType === 'Bounce') {
const { bounceType, bounceSubType } = this.msg.bounce
if (bounceSubType === "OnAccountSuppressionList") {
$end("Already on bounce suppression list. Exiting!")
}
// See https://docs.aws.amazon.com/ses/latest/DeveloperGuide/notification-contents.html
// A (Transient, General) bounce can actually occur when the user is OOO, so should
// probably not be added to the account suppression list
if (bounceType === 'Transient' && bounceSubType === 'General') {
$end("Transient, General bounce — probably not a permanent bounce")
}
details = `Details:
${JSON.stringify(this.msg.bounce.bouncedRecipients, null, 1)}`
}
this.details = details
async
params => {
}
const options = {
subject: params.subject,
text: params.text,
}
if (params.html) {
options.html = params.html
}
$send.email(options)