

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

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

如需如何以程式設計方式管理網域和設定檔的詳細資訊，請參閱 [Amazon Connect Customer Profiles API Reference](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 會執行每日計算，以提供屬性值的統計資訊，協助您了解資料中的模式和趨勢。統計計算每天執行一次，提供屬性資料特性的一致快照。

**請注意：**
+ 您會在兩種情況下收到 null 值：
  + 在啟用資料保存庫後的第一個期間 （除非發生計算週期，每天發生一次）。
  + 對於不包含數值的屬性。

我們建議您：將客戶設定檔整合至您自己的客服人員應用程式時，使用 CustomerProfileJS 開放原始碼程式庫。如需詳細資訊，請參閱 [Github](https://github.com/amazon-connect/amazon-connect-customer-profiles) 上的 CustomerProfilesJS 儲存庫。

如需有關如何將現有應用程式與 Amazon Connect 整合的詳細資訊，請使用 [Amazon Connect 串流](https://github.com/aws/amazon-connect-streams)。您可以將聯絡控制面板 (CCP) 元件嵌入到應用程式中。

# 了解 Amazon Connect Customer Profiles 中的 IPv6 支援
<a name="customerprofiles-ipv6-support"></a>

## 公共連線
<a name="public-connectivity"></a>

所有 Amazon Connect Customer Profiles API 都完全支援 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
```

舊 API 仍可作為回溯相容性使用。它們僅支援 IPv4 呼叫。

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

**例如**：

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

## 私人連線
<a name="private-connectivity"></a>

您可使用 Amazon VPC 主控台或 AWS Command Line Interface (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 名稱，向 Amazon Connect Customer Profiles 提出 API 請求，例如 profile.us-east-1.api.aws。

或者，僅 IPv4 支援該區域的舊 DNS 名稱。

**例如**：

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

# 範例：以程式設計方式整合 Amazon 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>

使用下列內容建立檔案：

```
{
    "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`：可以是字串 [a-zA-Z0-9][\$1w\$1@\$1.-]\$1
+ `ScheduleStartTime`：設定為紀元時間目前 `DateTime` \$1 5 分鐘。
+ `FirstExecutionFrom`：前往 S3，查看檔案日期，並使用最早日期之前的日期。
+ `Tasks`：定義 `TaskType`。在 `Sourcefields` 欄位中，您必須提供該陣列您的 CSV 的所有各欄。然後，對於該陣列中的每個項目，您需要指定 `ConnectorOperator`。此範例適用於具有兩欄：`colA` 和 `colB` 的 CSV 檔案。

## 步驟 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：呼叫 Amazon AppFlow StartFlow API
<a name="step3-cpintegration"></a>

使用流程 URI 呼叫 Amazon 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
```