Can't understand how to get SNS event data via HTTPS API endpoint protocol

0

I wanted to set up the configuration set to my SES (Amazon Simple Email Services) and have already done that with SNS (Amazon Simple Notification Services) but now it's with an email endpoint that can deliver with event type like emails Open, send, delivered, etc... & it was just a test purpose and was successful.

Now I want to create a subscription with HTTPS API endpoint like the below screenshot:

Screenshot Image

But the struggling part is how to receive the data from my application endpoint? The Email subscription is just receiving email after any event occurred but in the API need to receive data and then process this to my database.

Exactly I am stacked into the create SNS topic & subscribe to the HTTPS API endpoint & Receive Event data from the API endpoint, if I point out these then it will be like below

  1. Create SNS Topic for HTTPS endpoint
  2. Create a Subscription with HTTPS endpoint protocol
  3. Confirm the subscription with HTTPS API endpoint protocol
  4. Receive event data from HTTPS API endpoint

Here is the example link that I can't understand properly!

Thanks

2 Answers
1

One way you can experiment and learn is to use the webhook.site webapp, which will generate a public API URL that you can use in SNS and see the data as it's coming in.

Purdy
answered 2 years ago
  • Hi Purdy, Thanks for your reply! It was really a great hook for testing, but the problem exists still now, which is I couldn't get the query params to receive these data into my endpoint! You can see the below data coming after creation. How do I reciev?

    {
      "eventType": "Delivery",
      "mail": {
        "timestamp": "2022-07-21T08:31:29.513Z",
        "source": "hello@example.com",
        "sourceArn": "arn:aws:ses:ap-southeast-1:8632329965905:identity/hello@example.com",
        "sendingAccountId": "860059328965905",
        "messageId": "010e01821f124520e9-a1b669b0-06f4-4668-8ad5-b2eb6bb605c8-000000",
        "destination": [
          "john@ex.software"
        ],
        "headersTruncated": false,
        "headers": [
          {
            "name": "From",
            "value": "hello@example.com"
          },
          {
            "name": "To",
            "value": "john@ex.software"
          },
          {
            "name": "Subject",
            "value": "Discount Offer"
          },
          {
            "name": "MIME-Version",
            "value": "1.0"
          },
          {
            "name": "Content-Type",
            "value": "multipart/alternative;  boundary=\"----=_Part_8032350_320900719.1658392289516\""
          }
        ]
      },
      "delivery": {
        "timestamp": "2022-07-21T08:31:32.116Z",
        "processingTimeMillis": 2603,
        "recipients": [
          "john@ex.software"
        ],
        "smtpResponse": "250 2.0.0 OK  1658392xx292 x191-20020a6386c800087xx0b0041a03c29a95si1274597pgd.651 - gsmtp",
        "reportingMTA": "e262-6.smtp-out.ap-southeast-3.amazonses.com"
      }
    }
    

    Thanks

0

I'm not sure what you mean by query parameters, but I use a constant URL for the endpoint and rely on tags to identify the specific recipient. So when I send an email, I create a db row, which gives me the row ID from the database insert id. Then I use that ID as a tag in the destination. Then when I send the email, AWS SES returns the message ID, which I update the db row. And when the SQS message comes through, the tag is part of the message, which helps me match up the database row.

https://docs.aws.amazon.com/ses/latest/APIReference/API_BulkEmailDestination.html

Purdy
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions