Amazon SNS 在创建帐户后不发送短信

Amazon SNS not sending sms after account creation

我尝试用 amazon sns 发送短信,我收到了

短信已成功发布到phone号码+23481XXXXXXX。 消息“ID”:*********************

但是消息状态显示“失败”。

在开始发送短信之前,请问我在验证帐户后还需要做其他事情吗?

您可以激活传递状态日志记录以获得更详细的 SMS 消息日志。

来自Viewing Amazon CloudWatch metrics and logs for SMS deliveries - Amazon Simple Notification Service

  • 激活传递状态记录
  • 发送消息
  • 在 Amazon CloudWatch Logs 中查看结果

这是一个示例日志条目:

{
    "notification": {
        "messageId": "1077257a-92f3-5ca3-bc97-6a915b310625",
        "timestamp": "2016-06-28 00:40:34.559"
    },
    "delivery": {
        "mnc": 0,
        "destination": "+1XXX5550100",
        "priceInUSD": 0.00645,
        "smsType": "Transactional",
        "mcc": 0,
        "providerResponse": "Unknown error attempting to reach phone",
        "dwellTimeMs": 1420,
        "dwellTimeMsUntilDeviceAck": 1692
    },
    "status": "FAILURE"
}

您可能还想检查您使用的地区是否支持短信,以及您尝试发送的国家/地区是否支持。

https://docs.aws.amazon.com/sns/latest/dg/sns-supported-regions-countries.html

不确定这是否仅与 SNS 相关,或者如果您在 Cognito 中创建帐户后尝试发送短信,可能也想检查区域支持

https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-email-phone-verification.html