本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
故障排除
请熟悉问题排查信息和可能的解决方案,这将有助于您解决在使用 Amazon Pinpoint 时遇到的问题。
监控和日志记录
作为最佳实践,请考虑通过以下方式在 Amazon Pinpoint 中记录事件:
-
按照中的说明打开事件流 Amazon Kinesis Data Streams 使用 Amazon Pinpoint 流式传输事件。
-
使用自定义日志记录解决方案。有关更多信息,请参阅数字用户互动事件数据库
。涉及多种服务,并且会产生额外费用。 -
使用亚马逊 Pinpoint 支持的 Amazon CloudWatch 指标。有关更多信息,请参阅 使用 Amazon CloudWatch 监控 Amazon Pinpoint。
-
使用 Amazon Pinpoint API 调用已登录。 CloudTrail有关更多信息,请参阅《Amazon Pinpoint 开发者指南》中的使用 AWS CloudTrail记录 Amazon Pinpoint API 调用。
常见任务的 CLI 示例
以下示例是 Amazon Pinpoint 的常用 CLI 命令。
-
获取端点数据:get-endpoint CLI
aws pinpoint get-endpoint —application-id
AppId
—endpoint-idEndpointId
在前面的命令中,进行以下更改:
-
AppId
替换为包含终端节点的 Amazon Pinpoint 项目的编号。 -
EndpointId
替换为您正在检索的现有端点的 ID。
-
-
获取用户数据:get-user-endpointsCLI
aws pinpoint get-user-endpoints —application-id
AppId
—user-idUserId
在前面的命令中,进行以下更改:
-
AppId
替换为包含终端节点的 Amazon Pinpoint 项目的编号。 -
UserId
替换为用户的 ID。
-
-
更新或创建新端点:update-endpoint CLI
aws pinpoint update-endpoint —application-id
AppId
—endpoint-idEndpointId
—endpoint-request '{"ChannelType":"SMS","Address":"+12345678","Location":{"Country":"USA"},"User":{"UserId":"UserId
"}}'在前面的命令中,进行以下更改:
-
AppId
替换为包含终端节点的 Amazon Pinpoint 项目的编号。 -
EndpointId
替换为您正在创建或更新的现有终端节点的 ID。 -
UserId
替换为用户的 ID。
-
-
删除端点:delete-endpoint CLI
aws pinpoint delete-endpoint —application-id
AppId
—endpoint-idEndpointId
在前面的命令中,进行以下更改:
-
AppId
替换为包含终端节点的 Amazon Pinpoint 项目的编号。 -
EndpointId
替换为您要删除的现有终端节点的 ID。
-
-
验证电话号码:phone-number-validateCLI
aws pinpoint phone-number-validate —number-validate-request PhoneNumber=
+12065550100
在前面的命令中,进行以下更改:
-
将
+12065550100
替换为要验证的电话号码。
-
-
send-messages 示例 CLI:短信发往号码
aws pinpoint send-messages --application-id
AppID
--message-request '{"MessageConfiguration": {"SMSMessage":{"Body":"This is a test message"}},"Addresses": {"DestinationPhoneNumber
": {"ChannelType":"SMS"}}}‘在前面的命令中,进行以下更改:
-
AppId
替换为包含终端节点的 Amazon Pinpoint 项目的编号。 -
DestinationPhoneNumber
替换为您要发送的电话号码。
-
-
send-messages 示例 CLI:发起号码发出短信
aws pinpoint send-messages --application-id
AppID
--message-request '{"MessageConfiguration": {"SMSMessage":{"Body":"hello, how are you?","OriginationNumber": "OriginPhoneNumber
"}},"Addresses": {"DestinationPhoneNumber
": {"ChannelType":"SMS"}}}‘在前面的命令中,进行以下更改:
-
AppId
替换为包含终端节点的 Amazon Pinpoint 项目的编号。 -
OriginPhoneNumber
替换为您想要发送消息的电话号码。 -
DestinationPhoneNumber
替换为您要发送的电话号码。
-
-
send-messages 示例 CLI:短信发往端点
aws pinpoint send-messages —application-id
AppID
—message-request '{"MessageConfiguration": {"SMSMessage":{"Body":"This is a test message"}},"Endpoints": {"EndPointId
": {}}}'在前面的命令中,进行以下更改:
-
AppId
替换为包含终端节点的 Amazon Pinpoint 项目的编号。 -
EndPointId
替换为您要发送的现有终端节点的 ID。
-
-
send-messages 示例 CLI:短信发往 userId
aws pinpoint send-users-messages —application-id
AppID
—send-users-message-request '{"MessageConfiguration": {"SMSMessage":{"Body":"This is a test"}},"Users": {"UserId
": {}}}'在前面的命令中,进行以下更改:
-
AppId
替换为包含终端节点的 Amazon Pinpoint 项目的编号。 -
UserId
替换为用户的 ID。
-
-
通过 Amazon Pinpoint 消息模板 create-campaign CLI 创建活动
aws pinpoint create-campaign —application-id
AppId
—write-campaign-request file://campaignclirequest.json file://campaignclirequest.json { "Description": "CLITestCampaign", "HoldoutPercent": 0, "MessageConfiguration": { "DefaultMessage": { "Body": "TestFromCLI" } }, "Name": "TestingCLICampaign", "Schedule": { "StartTime": "IMMEDIATE" }, "TemplateConfiguration": { "EmailTemplate": { "Name": "TemplateName
", "Version": "Version
" } }, "SegmentId": "SegmentID
", "SegmentVersion": 1 }在前面的命令和文件中,进行以下更改:
-
AppId
替换为包含终端节点的 Amazon Pinpoint 项目的编号。 -
TemplateName
替换为模板的名称。 -
将
Version
替换为模板的版本。 -
将
SegmentID
替换为目标客户细分的 ID。
-