

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

# 使用 Amazon Connect Customer Profiles API
<a name="use-customerprofiles-api"></a>

有关如何以编程方式管理域和资料的信息，请参阅 [Amazon Connect Customer Profiles API 参考](https://docs.aws.amazon.com/customerprofiles/latest/APIReference/Welcome.html)。

## ListObjectTypeAttributeValues API
<a name="listobjecttypeattributevalues-api"></a>

 ListObjectTypeAttributeValues API 提供对任何指定属性的最新不同值的访问权限，因此对于对象类型内的实时数据验证和一致性检查非常有用。此 API 跨域运行，支持自定义和标准对象类型。API 接受对象类型名称、属性名称和域名作为输入参数，并返回的值不超过大约 350KB 的存储限制。

**注意：**
+ 我们每个字段最多可存储 350KB 的属性值，优先考虑最新的值。达到此限制后，将自动删除较旧的值，以便为新条目腾出空间。

## GetObjectTypeAttributeValues API
<a name="getobjecttypeattributevalues-api"></a>

该 GetObjectTypeAttributeValues API 提供有关特定对象类型内属性的统计见解，但仅适用于启用了数据存储的域。此 API 执行每日计算，以提供有关您的属性值的统计信息，从而帮助您了解数据的模式和趋势。统计计算每天执行一次，从而提供属性数据特征的一致快照。

**注意：**
+ 在两种情况下，您会收到空值：
  + 在启用 Data Vault 后的第一个时段（除非出现计算周期，即每天发生一次）。
  + 适用于不包含数值的属性。

我们建议在将客户档案集成到您自己的代理应用程序中时使用 CustomerProfile JS 开源库。有关更多信息，请参阅 [Github](https://github.com/amazon-connect/amazon-connect-customer-profiles) 上 CustomerProfiles的 JS 存储库。

有关如何将现有应用程序与 Amazon Connect 集成的更多信息，请使用 [Amazon Connect Streams](https://github.com/aws/amazon-connect-streams)。您可以将联系人控制面板 (CCP) 组件嵌入到应用中。

# 在 Amazon Connect 客户档案中了解 IPv6 支持
<a name="customerprofiles-ipv6-support"></a>

## 公有连接
<a name="public-connectivity"></a>

所有 Amazon Connect 客户档案都 APIs 完全支持 IPv4 和 IPv6 致电。

```
profile.Region.api.aws
```

**例如**：

```
profile.us-east-1.api.aws
```

对于 AWS CLI，您需要显式使用这些端点：

```
aws customer-profiles list-domains \
    --endpoint https://profile.us-east-1.api.aws \
    --region us-east-1
```

旧版本 APIs 仍可作为向后兼容性使用。他们只支持 IPv4 通话。

```
profile.Region.amazonaws.com
```

**例如**：

```
profile.us-east-1.amazonaws.com
```

## 私有连接
<a name="private-connectivity"></a>

您可以使用 Amazon VPC 控制台或 AWS 命令行界面（AWS CLI）为 Amazon Connect Customer Profiles 服务创建 VPC 端点。有关更多信息，请参阅 AWS PrivateLink 指南中的[创建接口终端节点](https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html)。

使用以下服务名称为 Amazon Connect Customer Profiles 创建 VPC 端点：

```
com.amazonaws.Region.profile
```

**例如**：

```
com.amazonaws.us-east-1.profile
```

如果您为终端节点启用私有 DNS，则可以使用该终端节点 IPv4 和该地区 IPv6 支持的 DNS 名称（例如 profile.us-east-1.api.aws）向 Amazon Connect 客户档案发出 API 请求。

或者，也 IPv4仅支持该地区的旧 DNS 名称。

**例如**：

```
profile.us-east-1.amazonaws.com
```

# 示例：以编程方式将 S3 与 Amazon Connect Customer Profiles 集成
<a name="customerprofiles-s3-integration"></a>

使用客户档案 [PutIntegration](https://docs.aws.amazon.com/customerprofiles/latest/APIReference/API_PutIntegration.html)API，您可以通过编程方式为 S3、Salesforce、Marketo 等创建集成。

在本主题中，我们将介绍如何创建同步间隔为 15 分钟（当前支持的最小值）的 S3 集成。

## 步骤 1：创建 JSON 文件
<a name="step1-cpintegration"></a>

使用以下内容创建 JSON 文件：

```
{
    "DomainName": "your-domain",
    "ObjectTypeName": "your-object-name", 
    "FlowDefinition": {
        "FlowName": "your-flow-name",
        "KmsArn": "the key ARN is the same as your domain's key",
        "Description": "Created by Customer Profiles",
        "TriggerConfig": {
            "TriggerType": "Scheduled",
            "TriggerProperties": {
                "Scheduled": {
                    "ScheduleExpression": "rate(15minutes)",
                    "DataPullMode": "Incremental",
                    "ScheduleStartTime": 1634244800.435,
                    "FirstExecutionFrom": 1594166400
                }
            }
        },
        "SourceFlowConfig": {
            "ConnectorType":"S3",
            "SourceConnectorProperties": {
                "S3": {
                    "BucketName": "your-bucket",
                    "BucketPrefix": "your-prefix"
                }
            }
        },
        "Tasks": [
            {"TaskType":"Filter","SourceFields":["colA","colB"],"ConnectorOperator":{"S3":"PROJECTION"}},
            {"ConnectorOperator":{"S3":"NO_OP"},"DestinationField":"colA","TaskProperties":{},"SourceFields":["colA"],"TaskType":"Map"},
            {"ConnectorOperator":{"S3":"NO_OP"},"DestinationField":"colB","TaskProperties":{},"SourceFields":["colB"],"TaskType":"Map"}
        ]
    }
}
```

要使用您自己的值自定义 JSON，请遵循以下准则：
+ `FlowName`：可以是 STRING [a-zA-Z0-9][\$1w\$1@\$1.-]\$1
+ `ScheduleStartTime`：设置为当前的 `DateTime` \$1 5 分钟（采用纪元时间）。
+ `FirstExecutionFrom`：转到 S3，查看文件日期，然后使用最早日期之前的日期。
+ `Tasks`：定义 `TaskType`。在 `Sourcefields` 字段中，您必须提供该数组中 CSV 中的所有列。然后，对于该数组中的每个项目，您需要指定 `ConnectorOperator`。此示例适用于包含两个列的 CSV 文档：`colA` 和 `colB`。

## 第 2 步：调用 PutIntegration API
<a name="step2-cpintegration"></a>

使用您的值创建并自定义 JSON 文件后，调用 [PutIntegration](https://docs.aws.amazon.com/customerprofiles/latest/APIReference/API_PutIntegration.html)API，如以下示例所示：

```
aws customer-profiles put-integration --cli-input-json file:///put_integration_s3_cli.json --region us-west-2                    
```

来自 `PutIntegration` 的响应返回一个流 URI。例如：

```
{
    "DomainName": "testDomain",
    "Uri": "arn:aws:appflow:us-west-2:9999999999999:flow/Customer_Profiles_testDomain_S3_Salesforce-Account_1634244122247",
    "ObjectTypeName": "your objec type",
    "CreatedAt": "2021-10-14T13:51:57.748000-07:00",
    "LastUpdatedAt": "2021-10-14T13:51:57.748000-07:00",
    "Tags": {}
}
```

## 第 3 步：调用亚马逊 AppFlow StartFlow API
<a name="step3-cpintegration"></a>

使用流程 URI 调用亚马逊 AppFlow [StartFlow](https://docs.aws.amazon.com/appflow/1.0/APIReference/API_StartFlow.html)API。例如：

```
aws appflow start-flow —flow-name uri --region us-west-2
```