1

Context

Right now I'm sending SMS messages using SNS, but without using topics, i.e. directly to the destination phone number. In this action I'm allowed to include "message attributes" (which are basically key-value pairs for metadata).

I have SNS set up to log delivery status of SMS messages to cloudwatch, and then cloudwatch set up to trigger a lambda when these logs are received.

Problem

However, the object received in the logs does not include the message attributes, is there a way to do so ?

Example

The received log looks something like:

{
    "notification": {
        "messageId": "34d9b400-c6dd-5444-820d-fbeb0f1f54cf",
        "timestamp": "2016-06-28 00:40:34.558"
    },
    "delivery": {
        "phoneCarrier": "My Phone Carrier",
        "mnc": 270,
        "destination": "+1XXX5550100",
        "priceInUSD": 0.00645,
        "smsType": "Transactional",
        "mcc": 310,
        "providerResponse": "Message has been accepted by phone carrier",
        "dwellTimeMs": 599,
        "dwellTimeMsUntilDeviceAck": 1344
    },
    "status": "SUCCESS"
}
  • Welcome to SO! Please see "[ask]", "[Stack Overflow question checklist](https://meta.stackoverflow.com/questions/260648)" and "[MCVE]" and all their linked pages. – the Tin Man Feb 20 '22 at 01:01

1 Answers1

0

SNS does not have the capability to deliver message attributes together with delivery status logs today.

What you could do is log the SNS message ID returned during the publish together with the message attributes within your application and correlate them that way.

bjrnt
  • 2,552
  • 3
  • 27
  • 38