Simple Email Service (SES) notifications via Simple Notification Service (SNS) - JSON sent is different from documenation?

0

I have completed all the steps to configure Amazon SES and SNS to send email event notifications to a webhook.

  1. Created the configuration set
  2. Added/confirmed the destination
  3. Added the configuration set header to emails sent via SMTP

I am receiving data. I've tested send, open, and click notifications thus far by placing a checkpoint on the listener and stepping through the process after sending, opening, and clicking a link in the email(s).

However, the JSON data received is not like what the Amazon documentation states, as listed here in the overview, and listed here with examples.

For example, this is what the documentation says a Send notification should look like:

{
  "eventType": "Send",
  "mail": {
    "timestamp": "2016-10-14T05:02:16.645Z",
    "source": "sender@example.com",
    "sourceArn": "arn:aws:ses:us-east-1:123456789012:identity/sender@example.com",
    "sendingAccountId": "123456789012",
    "messageId": "EXAMPLE7c191be45-e9aedb9a-02f9-4d12-a87d-dd0099a07f8a-000000",
    "destination": [
      "recipient@example.com"
    ],
    "headersTruncated": false,
    "headers": [
      {
        "name": "From",
        "value": "sender@example.com"
      },
      {
        "name": "To",
        "value": "recipient@example.com"
      },
      {
        "name": "Subject",
        "value": "Message sent from Amazon SES"
      },
      {
        "name": "MIME-Version",
        "value": "1.0"
      },
      {
        "name": "Content-Type",
        "value": "multipart/mixed;  boundary=\"----=_Part_0_716996660.1476421336341\""
      },
      {
        "name": "X-SES-MESSAGE-TAGS",
        "value": "myCustomTag1=myCustomTagValue1, myCustomTag2=myCustomTagValue2"
      }
    ],
    "commonHeaders": {
      "from": [
        "sender@example.com"
      ],
      "to": [
        "recipient@example.com"
      ],
      "messageId": "EXAMPLE7c191be45-e9aedb9a-02f9-4d12-a87d-dd0099a07f8a-000000",
      "subject": "Message sent from Amazon SES"
    },
    "tags": {
      "ses:configuration-set": [
        "ConfigSet"
      ],
      "ses:source-ip": [
        "192.0.2.0"
      ],
      "ses:from-domain": [
        "example.com"
      ],      
      "ses:caller-identity": [
        "ses_user"
      ],
      "myCustomTag1": [
        "myCustomTagValue1"
      ],
      "myCustomTag2": [
        "myCustomTagValue2"
      ]      
    }
  },
  "send": {}
}

However, this is not what is being sent to my listener/webhook. For example, when a Send notification comes in, this is what is being sent (redacted):

{
  "Type": "Notification",
  "MessageId": "",
  "TopicArn": "",
  "Subject": "Amazon SES Email Event Notification",
  "Message": "{",
  ":": {
    "timestamp": "",
    "source": "",
    "sourceArn": "",
    "sendingAccountId": "",
    "messageId": "",
    "destination": [
      ""
    ],
    "headersTruncated": false,
    "headers": [
      {
        "name": "Received",
        "value": ""
      },
      {
        "name": "X-SES-CONFIGURATION-SET",
        "value": ""
      },
      {
        "name": "thread-index",
        "value": ""
      },
      {
        "name": "Thread-Topic",
        "value": ""
      },
      {
        "name": "From",
        "value": ""
      },
      {
        "name": "To",
        "value": ""
      },
      {
        "name": "Subject",
        "value": ""
      },
      {
        "name": "Date",
        "value": ""
      },
      {
        "name": "Message-ID",
        "value": ""
      },
      {
        "name": "MIME-Version",
        "value": "1.0"
      },
      {
        "name": "Content-Type",
        "value": ""
      },
      {
        "name": "X-Mailer",
        "value": ""
      },
      {
        "name": "Content-Class",
        "value": ""
      },
      {
        "name": "Importance",
        "value": ""
      },
      {
        "name": "Priority",
        "value": ""
      },
      {
        "name": "X-MimeOLE",
        "value": ""
      }
    ],
    "commonHeaders": {
      "from": [],
      "date": "",
      "to": [],
      "messageId": "",
      "subject": ""
    },
    "tags": {
      "ses:operation": [],
      "ses:configuration-set": [],
      "ses:source-ip": [],
      "ses:from-domain": [],
      "ses:caller-identity": []
    }
  },
  "send": {}
}

The other notifications are similar, and nothing like the documentation, where the "eventType" is not included, and the "event" is always "notification". For example, here is what a "Click" notification includes:

{
  "Type": "Notification",
  "MessageId": "",
  "TopicArn": "",
  "Subject": "Amazon SES Email Event Notification",
  "Message": "{",
  ":": {
    "timestamp": "",
    "source": "",
    "sendingAccountId": "",
    "messageId": "",
    "destination": [],
    "headersTruncated": false,
    "headers": [
      {
        "name": "",
        "value": ""
      },
      {
        "name": "X-SES-CONFIGURATION-SET",
        "value": ""
      },
      {
        "name": "thread-index",
        "value": ""
      },
      {
        "name": "Thread-Topic",
        "value": ""
      },
      {
        "name": "From",
        "value": ""
      },
      {
        "name": "To",
        "value": ""
      },
      {
        "name": "Subject",
        "value": ""
      },
      {
        "name": "Date",
        "value": ""
      },
      {
        "name": "Message-ID",
        "value": ""
      },
      {
        "name": "MIME-Version",
        "value": ""
      },
      {
        "name": "Content-Type",
        "value": ""
      },
      {
        "name": "X-Mailer",
        "value": ""
      },
      {
        "name": "Content-Class",
        "value": ""
      },
      {
        "name": "Importance",
        "value": ""
      },
      {
        "name": "Priority",
        "value": ""
      },
      {
        "name": "X-MimeOLE",
        "value": ""
      }
    ],
    "commonHeaders": {
      "from": [],
      "date": "",
      "to": [],
      "messageId": "",
      "subject": ""
    },
    "tags": {
      "ses:operation": [],
      "ses:configuration-set": [],
      "ses:source-ip": [],
      "ses:from-domain": [],
      "ses:caller-identity": []
    }
  },
  "click": {
    "timestamp": "",
    "ipAddress": "",
    "userAgent": "",
    "link": "",
    "linkTags": null
  }
}

I could go down the road of looking for certain values in order to determine what type of event is being sent in, but I would have to generate every single event type (including bounce, spam, reject, etc) just to see what the JSON looks like in order to process it.

Did I miss something in the configuration? If not, is there documentation on what the JSON data looks like for this "type" of setup?

Aucune réponse

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions