如何啟用 SMS 傳送紀錄

步驟一

sms Console並點擊Delivery status logs底下的 Edit prefernces

步驟二

設定Sucess samole rate百分比, 可為 0, 10, 或為空白

  • 0為只紀錄發送錯誤

  • 10為只紀錄發送成功

  • 空值為紀錄所有

步驟三

新增一個 IAM Role

步驟四

完成後, 可以到CloudWatch Logs去觀看是否有新增一個sns/region/accountID/DirectPublishToPhoneNumberLog Groups

步驟五

點進去後可以看到Log, 並會有更詳細的紀錄

看起來會是這樣子

{
    "notification": {
        "messageId": "5c53065e-edb8-5815-b77a-5f579842a508",
        "timestamp": "2021-05-03 03:53:30.696"
    },
    "delivery": {
        "phoneCarrier": "Mobile Co Ltd.",
        "mnc": 97,
        "numberOfMessageParts": 1,
        "destination": "+88612345678",
        "priceInUSD": 0.05221,
        "smsType": "Promotional",
        "mcc": 466,
        "providerResponse": "Message has been accepted by phone",
        "dwellTimeMs": 183,
        "dwellTimeMsUntilDeviceAck": 56153
    },
    "status": "SUCCESS"
}