View a markdown version of this page

Notify の開始方法 - AWS エンドユーザーメッセージング SMS

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

Notify の開始方法

このチュートリアルでは、Notify 設定を作成し、最初の OTP メッセージを送信する手順を説明します。このチュートリアルは約 5 分で完了できます。

前提条件

次の 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": "*" } ] }

アクセス許可を特定の通知設定に制限するには、リソースレベルのアクション (SendNotifyTextMessage、、SendNotifyVoiceMessage、、UpdateNotifyConfiguration、 など) DescribeNotifyConfigurations CreateNotifyConfigurationの設定 ARN を使用しますDeleteNotifyConfiguration。リソースレベルのアクセス許可 (DescribeNotifyTemplatesListNotifyCountries、、SetNotifyMessageSpendLimitOverride、 などPutMessageFeedback) をサポートしないアクションにはDeleteNotifyMessageSpendLimitOverride、 が必要です"Resource": "*"

ステップ 1: 通知設定を作成する

Console
  1. https://console.aws.amazon.com/sms-voice/ で AWS エンドユーザーメッセージング SMS コンソールを開きます。

  2. ナビゲーションペインの「通知」で、「通知設定」を選択します。

  3. Create Notify 設定を選択します。

  4. 表示名に、ブランド名を入力します (例: AcmeCorp)。

  5. ユースケースでは、コード検証が自動的に選択されます。

  6. チャネルで、SMSVOICE、またはその両方を選択します。

  7. (オプション) 詳細設定を展開して、国、デフォルトのテンプレート、関連付けられたプールを選択するか、削除保護を有効にします。

  8. Create Notify 設定を選択します。

設定は、システムがアカウントを検証している間、保留中のステータスで作成されます。検証されると、ステータスはアクティブに変わり、メッセージの送信を開始できます。

注記

設定の作成には、自動アカウント検証とブランド名チェックが含まれます。ほとんどの設定は数秒以内にアクティブ化されます。ブランド名に検証が必要な場合、ステータスは検証が必要です

AWS CLI
aws pinpoint-sms-voice-v2 create-notify-configuration \ --display-name "AcmeCorp" \ --use-case CODE_VERIFICATION \ --enabled-channels SMS

設定ステータス:

保留中

設定は検証中です。

アクティブ

メッセージを送信する準備ができました。

REQUIRES_VERIFICATION

ブランド名には、アクティベーション前に検証が必要です。

拒否

設定が拒否されました。詳細については、RejectionReason「」を参照してください。

ステップ 2: 使用可能なテンプレートを参照する

送信する前に、階層とチャネルで使用できるテンプレートを確認してください。

aws pinpoint-sms-voice-v2 describe-notify-templates \ --filters '[{"Name":"channels","Values":["SMS"]},{"Name":"tier-access","Values":["BASIC"]}]'

ステップ 3: テストメッセージを送信する

Console
  1. 設定の通知リストで、設定を選択します。

  2. [テスト] タブを選択します。

  3. テンプレートテーブルからテンプレートを選択します。

  4. 送信先の電話番号には、E.164 形式で電話番号を入力します (例: +12065550100)。

  5. テンプレート変数を入力します (たとえば、コード変数123456に を入力します)。

  6. [送信] を選択します。

AWS CLI
aws pinpoint-sms-voice-v2 send-notify-text-message \ --notify-configuration-id "nc-1234567890abcdef0" \ --destination-phone-number "+12065550100" \ --template-id "notify-code-verification-english-001" \ --template-variables '{"code":"123456"}'
Python (boto3)
import boto3 client = boto3.client('pinpoint-sms-voice-v2') response = client.send_notify_text_message( NotifyConfigurationId='nc-1234567890abcdef0', DestinationPhoneNumber='+12065550100', TemplateId='notify-code-verification-english-001', TemplateVariables={ 'code': '123456' } ) print(f"Message ID: {response['MessageId']}") print(f"Resolved body: {response['ResolvedMessageBody']}")

ステップ 4: 利用可能な国を確認する

を使用してListNotifyCountries、階層とチャネルで利用可能な国を確認します。

aws pinpoint-sms-voice-v2 list-notify-countries \ --channels SMS \ --tier BASIC

次の手順