Amazon Pinpoint 的例子 AWS CLI - AWS Command Line Interface

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

Amazon Pinpoint 的例子 AWS CLI

下列程式碼範例說明如何透過 AWS Command Line Interface 搭配 Amazon Pinpoint 使用來執行動作和實作常見案例。

Actions 是大型程式的程式碼摘錄,必須在內容中執行。雖然動作會顯示如何呼叫個別服務函數,但您可以在其相關案例中查看內容中的動作。

每個範例都包含完整原始程式碼的連結,您可以在其中找到如何在內容中設定和執行程式碼的指示。

主題

動作

下列程式碼範例會示範如何使用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中的。

下列程式碼範例會示範如何使用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 位使用者指南中的 Amazon Pinpoint 訊息範本

下列程式碼範例會示範如何使用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中的。

下列程式碼範例會示範如何使用get-apns-channel

AWS CLI

擷取應用程式之APNs通道狀態和設定的相關資訊

下列get-apns-channel範例會擷取應用程式之APNs通道狀態和設定的相關資訊。

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中的。

下列程式碼範例會示範如何使用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中的。

下列程式碼範例會示範如何使用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中的。

下列程式碼範例會示範如何使用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中的。

下列程式碼範例會示範如何使用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中的。

下列程式碼範例會示範如何使用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中的。

下列程式碼範例會示範如何使用get-email-channel

AWS CLI

擷取應用程式之電子郵件通道狀態和設定的相關資訊

下列get-email-channel範例會擷取應用程式之電子郵件通道的狀態和設定。

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中的。

下列程式碼範例會示範如何使用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中的。

下列程式碼範例會示範如何使用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中的。

下列程式碼範例會示範如何使用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中的。

下列程式碼範例會示範如何使用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 位使用者指南中的 Amazon Pinpoint 訊息範本

  • 如需詳API細資訊,請參閱AWS CLI 指令參考GetSmsTemplate中的。

下列程式碼範例會示範如何使用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中的。

下列程式碼範例會示範如何使用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 精確定位開發人員https://docs.aws.amazon.com/pinpoint/指南中的「標記 Amazon 精確資源 < 最新/開發人員 Amazon Pinpoint 南/標記資源 .html>'__」。

下列程式碼範例會示範如何使用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 精確定位SMS管道

下列程式碼範例會示範如何使用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 精確定位SMS管道

  • 如需詳API細資訊,請參閱AWS CLI 指令參考SendMessages中的。

下列程式碼範例會示範如何使用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 精確定位SMS管道

下列程式碼範例會示範如何使用tag-resource

AWS CLI

若要將標籤新增至資源

下列範例會將兩個標籤 (金鑰名稱和值) 新增至資源。

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 精確定位開發人員https://docs.aws.amazon.com/pinpoint/指南中的「標記 Amazon 精確資源 < 最新/開發人員 Amazon Pinpoint 南/標記資源 .html>'__」。

  • 如需詳API細資訊,請參閱AWS CLI 指令參考TagResource中的。

下列程式碼範例會示範如何使用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 精確定位開發人員https://docs.aws.amazon.com/pinpoint/指南中的「標記 Amazon 精確資源 < 最新/開發人員 Amazon Pinpoint 南/標記資源 .html>'__」。

  • 如需詳API細資訊,請參閱AWS CLI 指令參考UntagResource中的。

下列程式碼範例會示範如何使用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 精確定位SMS管道

  • 如需詳API細資訊,請參閱AWS CLI 指令參考UpdateSmsChannel中的。