

# AWS CLI を使用した Amazon Pinpoint の例
<a name="cli_pinpoint_code_examples"></a>

次のコード例は、Amazon Pinpoint で AWS Command Line Interface を使用してアクションを実行し、一般的なシナリオを実装する方法を示しています。

*アクション*はより大きなプログラムからのコードの抜粋であり、コンテキスト内で実行する必要があります。アクションは個々のサービス機能を呼び出す方法を示していますが、コンテキスト内のアクションは、関連するシナリオで確認できます。

各例には完全なソースコードへのリンクが含まれており、コードの設定方法と実行方法に関する手順を確認できます。

**Topics**
+ [アクション](#actions)

## アクション
<a name="actions"></a>

### `create-app`
<a name="pinpoint_CreateApp_cli_topic"></a>

次のコード例は、`create-app` を使用する方法を示しています。

**AWS CLI**  
**例 1: アプリケーションを作成するには**  
次の `create-app` の例は、新しいアプリケーション (プロジェクト) を作成します。  

```
aws pinpoint create-app \
    --create-application-request Name=ExampleCorp
```
出力:  

```
{
    "ApplicationResponse": {
        "Arn": "arn:aws:mobiletargeting:us-west-2:AIDACKCEVSQ6C2EXAMPLE:apps/810c7aab86d42fb2b56c8c966example",
        "Id": "810c7aab86d42fb2b56c8c966example",
        "Name": "ExampleCorp",
        "tags": {}
    }
}
```
**例 2: タグが付けられたアプリケーションを作成するには**  
次の `create-app` の例は、新しいアプリケーション (プロジェクト) を作成し、タグ (キーと値) をアプリケーションに関連付けます。  

```
aws pinpoint create-app \
    --create-application-request Name=ExampleCorp,tags={"Stack"="Test"}
```
出力:  

```
{
    "ApplicationResponse": {
        "Arn": "arn:aws:mobiletargeting:us-west-2:AIDACKCEVSQ6C2EXAMPLE:apps/810c7aab86d42fb2b56c8c966example",
        "Id": "810c7aab86d42fb2b56c8c966example",
        "Name": "ExampleCorp",
        "tags": {
            "Stack": "Test"
        }
    }
}
```
+  API の詳細については、AWS CLI コマンドリファレンスの「[CreateApp](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/pinpoint/create-app.html)」を参照してください。**

### `create-sms-template`
<a name="pinpoint_CreateSmsTemplate_cli_topic"></a>

次のコード例は、`create-sms-template` を使用する方法を示しています。

**AWS CLI**  
**SMS チャンネルを介して送信されるメッセージのメッセージテンプレートを作成します**  
次の `create-sms-template` の例では、SMS メッセージテンプレートを作成します。  

```
aws pinpoint create-sms-template \
    --template-name TestTemplate \
    --sms-template-request file://myfile.json \
    --region us-east-1
```
`myfile.json` の内容:  

```
{
    "Body": "hello\n how are you?\n food is good",
    "TemplateDescription": "Test SMS Template"
}
```
出力:  

```
{
    "CreateTemplateMessageBody": {
        "Arn": "arn:aws:mobiletargeting:us-east-1:AIDACKCEVSQ6C2EXAMPLE:templates/TestTemplate/SMS",
        "Message": "Created",
        "RequestID": "8c36b17f-a0b0-400f-ac21-29e9b62a975d"
    }
}
```
詳細については、「*Amazon Pinpoint User Guide*」の「[Amazon Pinpoint message templates](https://docs.aws.amazon.com/pinpoint/latest/userguide/messages-templates.html)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[CreateSmsTemplate](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/pinpoint/create-sms-template.html)」を参照してください。

### `delete-app`
<a name="pinpoint_DeleteApp_cli_topic"></a>

次のコード例は、`delete-app` を使用する方法を示しています。

**AWS CLI**  
**アプリケーションを削除するには**  
次の `delete-app` の例は、アプリケーション (プロジェクト) を削除します。  

```
aws pinpoint delete-app \
    --application-id 810c7aab86d42fb2b56c8c966example
```
出力:  

```
{
    "ApplicationResponse": {
        "Arn": "arn:aws:mobiletargeting:us-west-2:AIDACKCEVSQ6C2EXAMPLE:apps/810c7aab86d42fb2b56c8c966example",
        "Id": "810c7aab86d42fb2b56c8c966example",
        "Name": "ExampleCorp",
        "tags": {}
    }
}
```
+  API の詳細については、AWS CLI コマンドリファレンスの「[DeleteApp](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/pinpoint/delete-app.html)」を参照してください。**

### `get-apns-channel`
<a name="pinpoint_GetApnsChannel_cli_topic"></a>

次のコード例は、`get-apns-channel` を使用する方法を示しています。

**AWS CLI**  
**アプリケーションの APN チャネルのステータスと設定に関する情報を取得するには**  
次の `get-apns-channel` の例では、アプリケーションの APN チャネルのステータスと設定に関する情報を取得します。  

```
aws pinpoint get-apns-channel \
    --application-id 9ab1068eb0a6461c86cce7f27ce0efd7 \
    --region us-east-1
```
出力:  

```
{
    "APNSChannelResponse": {
        "ApplicationId": "9ab1068eb0a6461c86cce7f27ce0efd7",
        "CreationDate": "2019-05-09T21:54:45.082Z",
        "DefaultAuthenticationMethod": "CERTIFICATE",
        "Enabled": true,
        "HasCredential": true,
        "HasTokenKey": false,
        "Id": "apns",
        "IsArchived": false,
        "LastModifiedDate": "2019-05-09T22:04:01.067Z",
        "Platform": "APNS",
        "Version": 2
    }
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[GetApnsChannel](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/pinpoint/get-apns-channel.html)」を参照してください。

### `get-app`
<a name="pinpoint_GetApp_cli_topic"></a>

次のコード例は、`get-app` を使用する方法を示しています。

**AWS CLI**  
**アプリケーション (プロジェクト) に関する情報を取得するには**  
次の `get-app` の例では、アプリケーション (プロジェクト) に関する情報を取得します。  

```
aws pinpoint get-app \
    --application-id 810c7aab86d42fb2b56c8c966example \
    --region us-east-1
```
出力:  

```
{
    "ApplicationResponse": {
        "Arn": "arn:aws:mobiletargeting:us-east-1:AIDACKCEVSQ6C2EXAMPLE:apps/810c7aab86d42fb2b56c8c966example",
        "Id": "810c7aab86d42fb2b56c8c966example",
        "Name": "ExampleCorp",
        "tags": {
                "Year": "2019",
                "Stack": "Production"
            }
    }
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[GetApp](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/pinpoint/get-app.html)」を参照してください。

### `get-apps`
<a name="pinpoint_GetApps_cli_topic"></a>

次のコード例は、`get-apps` を使用する方法を示しています。

**AWS CLI**  
**すべてのアプリケーションに関する情報を取得するには**  
次の `get-apps` の例では、すべてのアプリケーション (プロジェクト) に関する情報を取得します。  

```
aws pinpoint get-apps
```
出力:  

```
{
    "ApplicationsResponse": {
        "Item": [
            {
                "Arn": "arn:aws:mobiletargeting:us-west-2:AIDACKCEVSQ6C2EXAMPLE:apps/810c7aab86d42fb2b56c8c966example",
                "Id": "810c7aab86d42fb2b56c8c966example",
                "Name": "ExampleCorp",
                "tags": {
                    "Year": "2019",
                    "Stack": "Production"
                }
            },
            {
                "Arn": "arn:aws:mobiletargeting:us-west-2:AIDACKCEVSQ6C2EXAMPLE:apps/42d8c7eb0990a57ba1d5476a3example",
                "Id": "42d8c7eb0990a57ba1d5476a3example",
                "Name": "AnyCompany",
                "tags": {}
            },
            {
                "Arn": "arn:aws:mobiletargeting:us-west-2:AIDACKCEVSQ6C2EXAMPLE:apps/80f5c382b638ffe5ad12376bbexample",
                "Id": "80f5c382b638ffe5ad12376bbexample",
                "Name": "ExampleCorp_Test",
                "tags": {
                    "Year": "2019",
                    "Stack": "Test"
                }
            }
        ],
        "NextToken": "eyJDcmVhdGlvbkRhdGUiOiIyMDE5LTA3LTE2VDE0OjM4OjUzLjkwM1oiLCJBY2NvdW50SWQiOiI1MTIzOTcxODM4NzciLCJBcHBJZCI6Ijk1ZTM2MGRiMzBkMjQ1ZjRiYTYwYjhlMzllMzZlNjZhIn0"
    }
}
```
`NextToken` レスポンス値の存在は、使用可能な出力がさらにあることを示します。コマンドを再度呼び出し、その値を `NextToken` 入力パラメータとして指定します。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[GetApps](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/pinpoint/get-apps.html)」を参照してください。

### `get-campaign`
<a name="pinpoint_GetCampaign_cli_topic"></a>

次のコード例は、`get-campaign` を使用する方法を示しています。

**AWS CLI**  
**キャンペーンのステータス、構成、およびその他の設定に関する情報を取得するには**  
次の `get-campaign` の例では、キャンペーンのステータス、構成、およびその他の設定に関する情報を取得します。  

```
aws pinpoint get-campaign \
    --application-id 6e0b7591a90841d2b5d93fa11143e5a7 \
    --campaign-id a1e63c6cc0eb43ed826ffcc3cc90b30d \
    --region us-east-1
```
出力:  

```
{
    "CampaignResponse": {
        "AdditionalTreatments": [],
        "ApplicationId": "6e0b7591a90841d2b5d93fa11143e5a7",
        "Arn": "arn:aws:mobiletargeting:us-east-1:AIDACKCEVSQ6C2EXAMPLE:apps/6e0b7591a90841d2b5d93fa11143e5a7/campaigns/a1e63c6cc0eb43ed826ffcc3cc90b30d",
        "CreationDate": "2019-10-08T18:40:16.581Z",
        "Description": " ",
        "HoldoutPercent": 0,
        "Id": "a1e63c6cc0eb43ed826ffcc3cc90b30d",
        "IsPaused": false,
        "LastModifiedDate": "2019-10-08T18:40:16.581Z",
        "Limits": {
            "Daily": 0,
            "MaximumDuration": 60,
            "MessagesPerSecond": 50,
            "Total": 0
        },
        "MessageConfiguration": {
            "EmailMessage": {
                "FromAddress": "sender@example.com",
                "HtmlBody": "<!DOCTYPE html>\n  <html lang=\"en\">\n    <head>\n    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n</head>\n<body>Hello</body>\n</html>",
                "Title": "PinpointDemo"
            }
        },
        "Name": "MyCampaign",
        "Schedule": {
            "IsLocalTime": false,
            "StartTime": "IMMEDIATE",
            "Timezone": "utc"
        },
        "SegmentId": "b66c9e42f71444b2aa2e0ffc1df28f60",
        "SegmentVersion": 1,
        "State": {
            "CampaignStatus": "COMPLETED"
        },
        "tags": {},
        "TemplateConfiguration": {},
        "Version": 1
    }
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[GetCampaign](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/pinpoint/get-campaign.html)」を参照してください。

### `get-campaigns`
<a name="pinpoint_GetCampaigns_cli_topic"></a>

次のコード例は、`get-campaigns` を使用する方法を示しています。

**AWS CLI**  
**アプリケーションに関連付けられているすべてのキャンペーンのステータス、構成、およびその他の設定に関する情報を取得するには**  
次の `get-campaigns` の例では、アプリケーションに関連付けられているすべてのキャンペーンのステータス、構成、およびその他の設定に関する情報を取得します。  

```
aws pinpoint get-campaigns \
    --application-id 6e0b7591a90841d2b5d93fa11143e5a7 \
    --region us-east-1
```
出力:  

```
{
    "CampaignsResponse": {
        "Item": [
            {
                "AdditionalTreatments": [],
                "ApplicationId": "6e0b7591a90841d2b5d93fa11143e5a7",
                "Arn": "arn:aws:mobiletargeting:us-east-1:AIDACKCEVSQ6C2EXAMPLE:apps/6e0b7591a90841d2b5d93fa11143e5a7/campaigns/7e1280344c8f4a9aa40a00b006fe44f1",
                "CreationDate": "2019-10-08T18:40:22.905Z",
                "Description": " ",
                "HoldoutPercent": 0,
                "Id": "7e1280344c8f4a9aa40a00b006fe44f1",
                "IsPaused": false,
                "LastModifiedDate": "2019-10-08T18:40:22.905Z",
                "Limits": {},
                "MessageConfiguration": {
                    "EmailMessage": {
                        "FromAddress": "sender@example.com",
                        "HtmlBody": "<!DOCTYPE html>\n    <html lang=\"en\">\n    <head>\n    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n</head>\n<body>Hello</body>\n</html>",
                        "Title": "PInpointDemo Test"
                    }
                },
                "Name": "MyCampaign1",
                "Schedule": {
                    "IsLocalTime": false,
                    "QuietTime": {},
                    "StartTime": "IMMEDIATE",
                    "Timezone": "UTC"
                },
                "SegmentId": "b66c9e42f71444b2aa2e0ffc1df28f60",
                "SegmentVersion": 1,
                "State": {
                    "CampaignStatus": "COMPLETED"
                },
                "tags": {},
                "TemplateConfiguration": {},
                "Version": 1
            },
            {
                "AdditionalTreatments": [],
                "ApplicationId": "6e0b7591a90841d2b5d93fa11143e5a7",
                "Arn": "arn:aws:mobiletargeting:us-east-1:AIDACKCEVSQ6C2EXAMPLE:apps/6e0b7591a90841d2b5d93fa11143e5a7/campaigns/a1e63c6cc0eb43ed826ffcc3cc90b30d",
                "CreationDate": "2019-10-08T18:40:16.581Z",
                "Description": " ",
                "HoldoutPercent": 0,
                "Id": "a1e63c6cc0eb43ed826ffcc3cc90b30d",
                "IsPaused": false,
                "LastModifiedDate": "2019-10-08T18:40:16.581Z",
                "Limits": {
                    "Daily": 0,
                    "MaximumDuration": 60,
                    "MessagesPerSecond": 50,
                    "Total": 0
                },
                "MessageConfiguration": {
                    "EmailMessage": {
                        "FromAddress": "sender@example.com",
                        "HtmlBody": "<!DOCTYPE html>\n    <html lang=\"en\">\n    <head>\n    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n</head>\n<body>Demo</body>\n</html>",
                        "Title": "PinpointDemo"
                    }
                },
                "Name": "MyCampaign2",
                "Schedule": {
                    "IsLocalTime": false,
                    "StartTime": "IMMEDIATE",
                    "Timezone": "utc"
                },
                "SegmentId": "b66c9e42f71444b2aa2e0ffc1df28f60",
                "SegmentVersion": 1,
                "State": {
                    "CampaignStatus": "COMPLETED"
                },
                "tags": {},
                "TemplateConfiguration": {},
                "Version": 1
            }
        ]
    }
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[GetCampaigns](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/pinpoint/get-campaigns.html)」を参照してください。

### `get-channels`
<a name="pinpoint_GetChannels_cli_topic"></a>

次のコード例は、`get-channels` を使用する方法を示しています。

**AWS CLI**  
**アプリケーションの各チャンネルの履歴とステータスに関する情報を取得するには**  
次の `get-channels` の例では、アプリケーションの各チャンネルの履歴とステータスに関する情報を取得します。  

```
aws pinpoint get-channels \
    --application-id 6e0b7591a90841d2b5d93fa11143e5a7 \
    --region us-east-1
```
出力:  

```
{
    "ChannelsResponse": {
        "Channels": {
            "GCM": {
                "ApplicationId": "6e0b7591a90841d2b5d93fa11143e5a7",
                "CreationDate": "2019-10-08T18:28:23.182Z",
                "Enabled": true,
                "HasCredential": true,
                "Id": "gcm",
                "IsArchived": false,
                "LastModifiedDate": "2019-10-08T18:28:23.182Z",
                "Version": 1
            },
            "SMS": {
                "ApplicationId": "6e0b7591a90841d2b5d93fa11143e5a7",
                "CreationDate": "2019-10-08T18:39:18.511Z",
                "Enabled": true,
                "Id": "sms",
                "IsArchived": false,
                "LastModifiedDate": "2019-10-08T18:39:18.511Z",
                "Version": 1
            },
            "EMAIL": {
                "ApplicationId": "6e0b7591a90841d2b5d93fa11143e5a7",
                "CreationDate": "2019-10-08T18:27:23.990Z",
                "Enabled": true,
                "Id": "email",
                "IsArchived": false,
                "LastModifiedDate": "2019-10-08T18:27:23.990Z",
                "Version": 1
            },
            "IN_APP": {
                "Enabled": true,
                "IsArchived": false,
                "Version": 0
            }
        }
    }
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[GetChannels](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/pinpoint/get-channels.html)」を参照してください。

### `get-email-channel`
<a name="pinpoint_GetEmailChannel_cli_topic"></a>

次のコード例は、`get-email-channel` を使用する方法を示しています。

**AWS CLI**  
**アプリケーションの E メールチャネルのステータスと設定に関する情報を取得するには**  
次の `get-email-channel` の例では、アプリケーションの E メールチャネルのステータスと設定を取得します。  

```
aws pinpoint get-email-channel \
    --application-id 6e0b7591a90841d2b5d93fa11143e5a7 \
    --region us-east-1
```
出力:  

```
{
    "EmailChannelResponse": {
        "ApplicationId": "6e0b7591a90841d2b5d93fa11143e5a7",
        "CreationDate": "2019-10-08T18:27:23.990Z",
        "Enabled": true,
        "FromAddress": "sender@example.com",
        "Id": "email",
        "Identity": "arn:aws:ses:us-east-1:AIDACKCEVSQ6C2EXAMPLE:identity/sender@example.com",
        "IsArchived": false,
        "LastModifiedDate": "2019-10-08T18:27:23.990Z",
        "MessagesPerSecond": 1,
        "Platform": "EMAIL",
        "RoleArn": "arn:aws:iam::AIDACKCEVSQ6C2EXAMPLE:role/pinpoint-events",
        "Version": 1
    }
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[GetEmailChannel](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/pinpoint/get-email-channel.html)」を参照してください。

### `get-endpoint`
<a name="pinpoint_GetEndpoint_cli_topic"></a>

次のコード例は、`get-endpoint` を使用する方法を示しています。

**AWS CLI**  
**アプリケーションの特定のエンドポイントの設定と属性に関する情報を取得するには**  
次の `get-endpoint` の例は、アプリケーションの指定されたエンドポイントの設定と属性に関する情報を取得します。  

```
aws pinpoint get-endpoint \
    --application-id 611e3e3cdd47474c9c1399a505665b91 \
    --endpoint-id testendpoint \
    --region us-east-1
```
出力:  

```
{
    "EndpointResponse": {
        "Address": "+11234567890",
        "ApplicationId": "611e3e3cdd47474c9c1399a505665b91",
        "Attributes": {},
        "ChannelType": "SMS",
        "CohortId": "63",
        "CreationDate": "2019-01-28T23:55:11.534Z",
        "EffectiveDate": "2021-08-06T00:04:51.763Z",
        "EndpointStatus": "ACTIVE",
        "Id": "testendpoint",
        "Location": {
            "Country": "USA"
        },
        "Metrics": {
            "SmsDelivered": 1.0
        },
        "OptOut": "ALL",
        "RequestId": "a204b1f2-7e26-48a7-9c80-b49a2143489d",
        "User": {
            "UserAttributes": {
                "Age": [
                    "24"
                ]
            },
        "UserId": "testuser"
        }
    }
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[GetEndpoint](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/pinpoint/get-endpoint.html)」を参照してください。

### `get-gcm-channel`
<a name="pinpoint_GetGcmChannel_cli_topic"></a>

次のコード例は、`get-gcm-channel` を使用する方法を示しています。

**AWS CLI**  
**アプリケーションの GCM チャネルのステータスと設定に関する情報を取得するには**  
次の `get-gcm-channel` の例では、アプリケーションの GCM チャネルのステータスと設定に関する情報を取得します。  

```
aws pinpoint get-gcm-channel \
    --application-id 6e0b7591a90841d2b5d93fa11143e5a7 \
    --region us-east-1
```
出力:  

```
{
    "GCMChannelResponse": {
        "ApplicationId": "6e0b7591a90841d2b5d93fa11143e5a7",
        "CreationDate": "2019-10-08T18:28:23.182Z",
        "Enabled": true,
        "HasCredential": true,
        "Id": "gcm",
        "IsArchived": false,
        "LastModifiedDate": "2019-10-08T18:28:23.182Z",
        "Platform": "GCM",
        "Version": 1
    }
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[GetGcmChannel](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/pinpoint/get-gcm-channel.html)」を参照してください。

### `get-sms-channel`
<a name="pinpoint_GetSmsChannel_cli_topic"></a>

次のコード例は、`get-sms-channel` を使用する方法を示しています。

**AWS CLI**  
**アプリケーションの SMS チャネルのステータスおよび設定に関する情報を取得するには**  
次の `get-sms-channel` の例は、アプリケーションの SMS チャネルのステータスと設定を取得します。  

```
aws pinpoint get-sms-channel \
    --application-id 6e0b7591a90841d2b5d93fa11143e5a7 \
    --region us-east-1
```
出力:  

```
{
    "SMSChannelResponse": {
        "ApplicationId": "6e0b7591a90841d2b5d93fa11143e5a7",
        "CreationDate": "2019-10-08T18:39:18.511Z",
        "Enabled": true,
        "Id": "sms",
        "IsArchived": false,
        "LastModifiedDate": "2019-10-08T18:39:18.511Z",
        "Platform": "SMS",
        "PromotionalMessagesPerSecond": 20,
        "TransactionalMessagesPerSecond": 20,
        "Version": 1
    }
}
```
+  API の詳細については、AWS CLI コマンドリファレンスの「[GetSmsChannel](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/pinpoint/get-sms-channel.html)」を参照してください。**

### `get-sms-template`
<a name="pinpoint_GetSmsTemplate_cli_topic"></a>

次のコード例は、`get-sms-template` を使用する方法を示しています。

**AWS CLI**  
**SMS チャネルを介して送信されるメッセージのメッセージテンプレートの内容と設定を取得します**  
次の `get-sms-template` の例では、SMS メッセージテンプレートの内容と設定を取得します。  

```
aws pinpoint get-sms-template \
    --template-name TestTemplate \
    --region us-east-1
```
出力:  

```
{
    "SMSTemplateResponse": {
        "Arn": "arn:aws:mobiletargeting:us-east-1:AIDACKCEVSQ6C2EXAMPLE:templates/TestTemplate/SMS",
        "Body": "hello\n how are you?\n food is good",
        "CreationDate": "2023-06-20T21:37:30.124Z",
        "LastModifiedDate": "2023-06-20T21:37:30.124Z",
        "tags": {},
        "TemplateDescription": "Test SMS Template",
        "TemplateName": "TestTemplate",
        "TemplateType": "SMS",
        "Version": "1"
    }
}
```
詳細については、「*Amazon Pinpoint User Guide*」の「[Amazon Pinpoint message templates](https://docs.aws.amazon.com/pinpoint/latest/userguide/messages-templates.html)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[GetSmsTemplate](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/pinpoint/get-sms-template.html)」を参照してください。

### `get-voice-channel`
<a name="pinpoint_GetVoiceChannel_cli_topic"></a>

次のコード例は、`get-voice-channel` を使用する方法を示しています。

**AWS CLI**  
**アプリケーションの音声チャンネルのステータスと設定に関する情報を取得するには**  
次の `get-voice-channel` の例では、アプリケーションの音声チャネルのステータスと設定を取得します。  

```
aws pinpoint get-voice-channel \
    --application-id 6e0b7591a90841d2b5d93fa11143e5a7 \
    --region us-east-1
```
出力:  

```
{
    "VoiceChannelResponse": {
        "ApplicationId": "6e0b7591a90841d2b5d93fa11143e5a7",
        "CreationDate": "2022-04-28T00:17:03.836Z",
        "Enabled": true,
        "Id": "voice",
        "IsArchived": false,
        "LastModifiedDate": "2022-04-28T00:17:03.836Z",
        "Platform": "VOICE",
        "Version": 1
    }
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[GetVoiceChannel](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/pinpoint/get-voice-channel.html)」を参照してください。

### `list-tags-for-resource`
<a name="pinpoint_ListTagsForResource_cli_topic"></a>

次のコード例は、`list-tags-for-resource` を使用する方法を示しています。

**AWS CLI**  
**リソースのタグの一覧を取得するには**  
次の `list-tags-for-resource` の例では、指定されたリソースに関連付けられているすべてのタグ (キー名と値) を取得します。  

```
aws pinpoint list-tags-for-resource \
    --resource-arn arn:aws:mobiletargeting:us-west-2:AIDACKCEVSQ6C2EXAMPLE:apps/810c7aab86d42fb2b56c8c966example
```
出力:  

```
{
    "TagsModel": {
        "tags": {
            "Year": "2019",
            "Stack": "Production"
        }
    }
}
```
詳細については、「*Amazon Pinpoint Developer Guide*」の「Tagging Amazon Pinpoint Resources <https://docs.aws.amazon.com/pinpoint/latest/developerguide/tagging-resources.html>」を参照してください。  
+  API の詳細については、「AWS CLI コマンドリファレンス」の「[ListTagsForResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/pinpoint/list-tags-for-resource.html)」を参照してください。

### `phone-number-validate`
<a name="pinpoint_PhoneNumberValidate_cli_topic"></a>

次のコード例は、`phone-number-validate` を使用する方法を示しています。

**AWS CLI**  
**電話番号に関する情報を取得します**  
次の `phone-number-validate` では、電話番号に関する情報を取得します。　  

```
aws pinpoint phone-number-validate \
    --number-validate-request PhoneNumber="+12065550142" \
    --region us-east-1
```
出力:  

```
{
    "NumberValidateResponse": {
        "Carrier": "ExampleCorp Mobile",
        "City": "Seattle",
        "CleansedPhoneNumberE164": "+12065550142",
        "CleansedPhoneNumberNational": "2065550142",
        "Country": "United States",
        "CountryCodeIso2": "US",
        "CountryCodeNumeric": "1",
        "OriginalPhoneNumber": "+12065550142",
        "PhoneType": "MOBILE",
        "PhoneTypeCode": 0,
        "Timezone": "America/Los_Angeles",
        "ZipCode": "98101"
    }
}
```
詳細については、「Amazon Pinpoint ユーザーガイド」の「[Amazon Pinpoint SMS チャンネル](https://docs.aws.amazon.com/pinpoint/latest/userguide/channels-sms.html)」を参照してください。**  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[PhoneNumberValidate](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/pinpoint/phone-number-validate.html)」を参照してください。

### `send-messages`
<a name="pinpoint_SendMessages_cli_topic"></a>

次のコード例は、`send-messages` を使用する方法を示しています。

**AWS CLI**  
**アプリケーションのエンドポイントを使用して SMS メッセージを送信するには**  
次の `send-messages` の例は、エンドポイントを使用してアプリケーションにダイレクトメッセージを送信します。  

```
aws pinpoint send-messages \
    --application-id 611e3e3cdd47474c9c1399a505665b91 \
    --message-request file://myfile.json \
    --region us-west-2
```
`myfile.json` の内容:  

```
{
    "MessageConfiguration": {
        "SMSMessage": {
            "Body": "hello, how are you?"
        }
    },
    "Endpoints": {
        "testendpoint": {}
    }
}
```
出力:  

```
{
    "MessageResponse": {
        "ApplicationId": "611e3e3cdd47474c9c1399a505665b91",
        "EndpointResult": {
            "testendpoint": {
                "Address": "+12345678900",
                "DeliveryStatus": "SUCCESSFUL",
                "MessageId": "itnuqhai5alf1n6ahv3udc05n7hhddr6gb3lq6g0",
                "StatusCode": 200,
                "StatusMessage": "MessageId: itnuqhai5alf1n6ahv3udc05n7hhddr6gb3lq6g0"
            }
        },
        "RequestId": "c7e23264-04b2-4a46-b800-d24923f74753"
    }
}
```
詳細については、「Amazon Pinpoint ユーザーガイド」の「[Amazon Pinpoint SMS チャンネル](https://docs.aws.amazon.com/pinpoint/latest/userguide/channels-sms.html)」を参照してください。**  
+  API の詳細については、AWS CLI コマンドリファレンス**の「[SendMessages](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/pinpoint/send-messages.html)」を参照してください。

### `send-users-messages`
<a name="pinpoint_SendUsersMessages_cli_topic"></a>

次のコード例は、`send-users-messages` を使用する方法を示しています。

**AWS CLI**  
**アプリケーションのユーザーに SMS メッセージを送信するには**  
次の `send-users-messages` の例では、アプリケーションのユーザー向けのダイレクトメッセージを送信します。  

```
aws pinpoint send-users-messages \
    --application-id 611e3e3cdd47474c9c1399a505665b91 \
    --send-users-message-request file://myfile.json \
    --region us-west-2
```
`myfile.json` の内容:  

```
{
    "MessageConfiguration": {
        "SMSMessage": {
            "Body": "hello, how are you?"
        }
    },
    "Users": {
        "testuser": {}
    }
}
```
出力:  

```
{
    "SendUsersMessageResponse": {
        "ApplicationId": "611e3e3cdd47474c9c1399a505665b91",
        "RequestId": "e0b12cf5-2359-11e9-bb0b-d5fb91876b25",
        "Result": {
            "testuser": {
                "testuserendpoint": {
                    "DeliveryStatus": "SUCCESSFUL",
                    "MessageId": "7qu4hk5bqhda3i7i2n4pjf98qcuh8b7p45ifsmo0",
                    "StatusCode": 200,
                    "StatusMessage": "MessageId: 7qu4hk5bqhda3i7i2n4pjf98qcuh8b7p45ifsmo0",
                    "Address": "+12345678900"
                }
            }
        }
    }
}
```
詳細については、「Amazon Pinpoint ユーザーガイド」の「[Amazon Pinpoint SMS チャンネル](https://docs.aws.amazon.com/pinpoint/latest/userguide/channels-sms.html)」を参照してください。**  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[SendUsersMessages](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/pinpoint/send-users-messages.html)」を参照してください。

### `tag-resource`
<a name="pinpoint_TagResource_cli_topic"></a>

次のコード例は、`tag-resource` を使用する方法を示しています。

**AWS CLI**  
**リソースにタグを追加するには**  
次の例では、リソースに 2 つのタグ (キー名と値) を追加します。  

```
aws pinpoint list-tags-for-resource \
    --resource-arn arn:aws:mobiletargeting:us-east-1:AIDACKCEVSQ6C2EXAMPLE:apps/810c7aab86d42fb2b56c8c966example \
    --tags-model tags={Stack=Production,Year=2019}
```
このコマンドでは何も出力されません。  
詳細については、「*Amazon Pinpoint Developer Guide*」の「Tagging Amazon Pinpoint Resources <https://docs.aws.amazon.com/pinpoint/latest/developerguide/tagging-resources.html>」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[TagResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/pinpoint/tag-resource.html)」を参照してください。

### `untag-resource`
<a name="pinpoint_UntagResource_cli_topic"></a>

次のコード例は、`untag-resource` を使用する方法を示しています。

**AWS CLI**  
**例 1: リソースからタグを削除するには**  
次の `untag-resource` の例では、指定されたタグ (キー名と値) をリソースから削除します。  

```
aws pinpoint untag-resource \
    --resource-arn arn:aws:mobiletargeting:us-west-2:AIDACKCEVSQ6C2EXAMPLE:apps/810c7aab86d42fb2b56c8c966example \
    --tag-keys Year
```
このコマンドでは何も出力されません。  
**例 2: リソースから複数のタグを削除するには**  
次の `untag-resource` の例では、指定されたタグ (キー名と値) をリソースから削除します。  

```
aws pinpoint untag-resource \
    --resource-arn arn:aws:mobiletargeting:us-east-1:AIDACKCEVSQ6C2EXAMPLE:apps/810c7aab86d42fb2b56c8c966example \
    --tag-keys Year Stack
```
このコマンドでは何も出力されません。  
詳細については、「*Amazon Pinpoint Developer Guide*」の「Tagging Amazon Pinpoint Resources <https://docs.aws.amazon.com/pinpoint/latest/developerguide/tagging-resources.html>」を参照してください。  
+  API の詳細については、「AWS CLI コマンドリファレンス」の「[UntagResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/pinpoint/untag-resource.html)」を参照してください。

### `update-sms-channel`
<a name="pinpoint_UpdateSmsChannel_cli_topic"></a>

次のコード例は、`update-sms-channel` を使用する方法を示しています。

**AWS CLI**  
**SMS チャネルを有効にするか、アプリケーションの SMS チャネルのステータスと設定を更新するには**  
次の `update-sms-channel` の例では、アプリケーションの SMS チャネルの SMS チャネルを有効にします。  

```
aws pinpoint update-sms-channel \
    --application-id 611e3e3cdd47474c9c1399a505665b91 \
    --sms-channel-request Enabled=true \
    --region us-west-2
```
出力:  

```
{
    "SMSChannelResponse": {
        "ApplicationId": "611e3e3cdd47474c9c1399a505665b91",
        "CreationDate": "2019-01-28T23:25:25.224Z",
        "Enabled": true,
        "Id": "sms",
        "IsArchived": false,
        "LastModifiedDate": "2023-05-18T23:22:50.977Z",
        "Platform": "SMS",
        "PromotionalMessagesPerSecond": 20,
        "TransactionalMessagesPerSecond": 20,
        "Version": 3
    }
}
```
詳細については、「Amazon Pinpoint ユーザーガイド」の「[Amazon Pinpoint SMS チャンネル](https://docs.aws.amazon.com/pinpoint/latest/userguide/channels-sms.html)」を参照してください。**  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[UpdateSmsChannel](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/pinpoint/update-sms-channel.html)」を参照してください。