本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
开始使用 “通知”
本教程将引导您创建通知配置并发送第一条 OTP 消息。你可以在大约 5 分钟内完成本教程。
先决条件
一个 AWS 账户。
AWS 最终用户消息 SMS 操作的 IAM 权限。有关更多信息,请参阅 AWS 最终用户消息 SMS 的身份和访问管理。
以下 IAM 策略授予发送消息和浏览模板的权限:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "sms-voice:SendNotifyTextMessage", "sms-voice:SendNotifyVoiceMessage", "sms-voice:DescribeNotifyTemplates", "sms-voice:DescribeNotifyConfigurations", "sms-voice:ListNotifyCountries", "sms-voice:PutMessageFeedback" ], "Resource": "*" } ] }
以下策略授予完全的 “通知” 管理权限:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "sms-voice:CreateNotifyConfiguration", "sms-voice:UpdateNotifyConfiguration", "sms-voice:DeleteNotifyConfiguration", "sms-voice:DescribeNotifyConfigurations", "sms-voice:DescribeNotifyTemplates", "sms-voice:ListNotifyCountries", "sms-voice:SendNotifyTextMessage", "sms-voice:SendNotifyVoiceMessage", "sms-voice:SetNotifyMessageSpendLimitOverride", "sms-voice:DeleteNotifyMessageSpendLimitOverride", "sms-voice:PutMessageFeedback" ], "Resource": "*" } ] }
要将权限限制为特定 Notify 配置,请使用配置 ARN 进行资源级操作(例如SendNotifyTextMessage、、、SendNotifyVoiceMessageDescribeNotifyConfigurationsCreateNotifyConfiguration、UpdateNotifyConfiguration和)。DeleteNotifyConfiguration不支持资源级权限(例如DescribeNotifyTemplates、、ListNotifyCountriesSetNotifyMessageSpendLimitOverrideDeleteNotifyMessageSpendLimitOverride、和PutMessageFeedback)的操作需要。"Resource": "*"
步骤 1:创建通知配置
配置状态:
- PENDING
正在验证配置。
- ACTIVE
准备发送消息。
- 需要验证
品牌名称需要在激活之前进行验证。
- REJECTED
配置被拒绝。查看
RejectionReason详情。
第 2 步:浏览可用模板
在发送之前,请检查您的等级和频道有哪些模板可用:
aws pinpoint-sms-voice-v2 describe-notify-templates \ --filters '[{"Name":"channels","Values":["SMS"]},{"Name":"tier-access","Values":["BASIC"]}]'
步骤 3:发送测试消息
第 4 步:查看可用国家
使用ListNotifyCountries查看哪些国家/地区适用于您的等级和频道:
aws pinpoint-sms-voice-v2 list-notify-countries \ --channels SMS \ --tier BASIC