使用 Amazon Pinpoint 示例 Amazon CLI - Amazon Command Line Interface
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

使用 Amazon Pinpoint 示例 Amazon CLI

以下代码示例向您展示了如何使用 Amazon Command Line Interface 与 Amazon Pinpoint 配合使用来执行操作和实现常见场景。

操作是大型程序的代码摘录,必须在上下文中运行。您可以通过操作了解如何调用单个服务函数,还可以通过函数相关场景和跨服务示例的上下文查看操作。

场景是展示如何通过在同一服务中调用多个函数来完成特定任务任务的代码示例。

每个示例都包含一个指向的链接 GitHub,您可以在其中找到有关如何在上下文中设置和运行代码的说明。

主题

操作

以下代码示例演示如何使用 create-app

Amazon 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 的详细信息,请参阅Amazon CLI 命令参考CreateApp中的。

以下代码示例演示如何使用 create-sms-template

Amazon 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" } }

有关更多信息,请参阅亚马逊 Pinpoint 用户指南中的亚马逊 Pinpoin t 消息模板

  • 有关 API 的详细信息,请参阅Amazon CLI 命令参考CreateSmsTemplate中的。

以下代码示例演示如何使用 delete-app

Amazon 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 的详细信息,请参阅Amazon CLI 命令参考DeleteApp中的。

以下代码示例演示如何使用 get-apns-channel

Amazon 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 的详细信息,请参阅Amazon CLI 命令参考GetApnsChannel中的。

以下代码示例演示如何使用 get-app

Amazon 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 的详细信息,请参阅Amazon CLI 命令参考GetApp中的。

以下代码示例演示如何使用 get-apps

Amazon 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 的详细信息,请参阅Amazon CLI 命令参考GetApps中的。

以下代码示例演示如何使用 get-campaign

Amazon 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 的详细信息,请参阅Amazon CLI 命令参考GetCampaign中的。

以下代码示例演示如何使用 get-campaigns

Amazon 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 的详细信息,请参阅Amazon CLI 命令参考GetCampaigns中的。

以下代码示例演示如何使用 get-channels

Amazon 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 的详细信息,请参阅Amazon CLI 命令参考GetChannels中的。

以下代码示例演示如何使用 get-email-channel

Amazon 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 的详细信息,请参阅Amazon CLI 命令参考GetEmailChannel中的。

以下代码示例演示如何使用 get-endpoint

Amazon 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 的详细信息,请参阅Amazon CLI 命令参考GetEndpoint中的。

以下代码示例演示如何使用 get-gcm-channel

Amazon 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 的详细信息,请参阅Amazon CLI 命令参考GetGcmChannel中的。

以下代码示例演示如何使用 get-sms-channel

Amazon CLI

检索有关应用程序的短信渠道的状态和设置的信息

以下 get-sms-channel 示例检索应用程序的短信渠道的状态和设置。

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 的详细信息,请参阅Amazon CLI 命令参考GetSmsChannel中的。

以下代码示例演示如何使用 get-sms-template

Amazon 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" } }

有关更多信息,请参阅亚马逊 Pinpoint 用户指南中的亚马逊 Pinpoin t 消息模板

  • 有关 API 的详细信息,请参阅Amazon CLI 命令参考GetSmsTemplate中的。

以下代码示例演示如何使用 get-voice-channel

Amazon 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 的详细信息,请参阅Amazon CLI 命令参考GetVoiceChannel中的。

以下代码示例演示如何使用 list-tags-for-resource

Amazon 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" } } }

有关更多信息,请参阅《亚马逊 Pinpoint 开发者指南》中的 “标记亚马逊 Pinpoint 资源” __。 < https://docs.aws.amazon.com/pinpoint/latest/developerguide/tagging-resources.html>

以下代码示例演示如何使用 phone-number-validate

Amazon 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 渠道

以下代码示例演示如何使用 send-messages

Amazon CLI

使用应用程序的端点发送短信

以下 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 渠道

  • 有关 API 的详细信息,请参阅Amazon CLI 命令参考SendMessages中的。

以下代码示例演示如何使用 send-users-messages

Amazon 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 渠道

  • 有关 API 的详细信息,请参阅Amazon CLI 命令参考SendUsersMessages中的。

以下代码示例演示如何使用 tag-resource

Amazon 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}

此命令不生成任何输出。

有关更多信息,请参阅《亚马逊 Pinpoint 开发者指南》中的 “标记亚马逊 Pinpoint 资源” __。 < https://docs.aws.amazon.com/pinpoint/latest/developerguide/tagging-resources.html>

  • 有关 API 的详细信息,请参阅Amazon CLI 命令参考TagResource中的。

以下代码示例演示如何使用 untag-resource

Amazon 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

此命令不生成任何输出。

有关更多信息,请参阅《亚马逊 Pinpoint 开发者指南》中的 “标记亚马逊 Pinpoint 资源” __。 < https://docs.aws.amazon.com/pinpoint/latest/developerguide/tagging-resources.html>

  • 有关 API 的详细信息,请参阅Amazon CLI 命令参考UntagResource中的。

以下代码示例演示如何使用 update-sms-channel

Amazon CLI

启用短信频道或更新应用程序短信频道的状态和设置。

以下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 渠道

  • 有关 API 的详细信息,请参阅Amazon CLI 命令参考UpdateSmsChannel中的。