[AWS] 啟用AWS SMS 傳送 Log
如何啟用 SMS
傳送紀錄
步驟一
到sms Console
並點擊Delivery status logs
底下的 Edit prefernces

步驟二
設定Sucess samole rate
百分比, 可為 0
, 10
, 或為空白
-
0
為只紀錄發送錯誤 -
10
為只紀錄發送成功 -
空值
為紀錄所有

步驟三
新增一個 IAM Role
步驟四
完成後, 可以到CloudWatch Logs
去觀看是否有新增一個sns/region/accountID/DirectPublishToPhoneNumber
的Log 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"
}