Send me an email on SES bounce / complaint notifications
@dylburger
code:
data:privatelast updated:5 years ago
today
Build integrations remarkably fast!
You're viewing a public workflow template.
Sign up to customize, add steps, modify code and more.
Join 1,000,000+ developers using the Pipedream platform
steps.
trigger
HTTP API
Deploy to generate unique URL
This workflow runs on Pipedream's servers and is triggered by HTTP / Webhook requests.
steps.
parse_sns_message
auth
to use OAuth tokens and API keys in code via theauths object
code
Write any Node.jscodeand use anynpm package. You can alsoexport datafor use in later steps via return or this.key = 'value', pass input data to your code viaparams, and maintain state across executions with$checkpoint.
async (event, steps) => {
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
}
23
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
steps.
email_me
Customize and send an email to the email address you registered with Pipedream. The email will be sent by notifications@pipedream.com.
params
Subject
 
string ·params.subject
Text
 
string ·params.text
Optional
code
async params => {
1
2
3
4
5
6
7
8
9
}
10
const options = {
  subject: params.subject,
  text: params.text,
}
if (params.html) {
  options.html = params.html
}
$send.email(options)