

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

# 使用事件觸發程序建立對外行銷活動
<a name="how-to-create-campaigns-using-event-triggers"></a>

**在 Connect Customer 管理網站中設定事件觸發條件**

1. 在**行銷活動設定**頁面上，選取**接收者**下的**客戶事件**。  
![在 [接收者] 區段下為事件觸發行銷活動選取了 [客戶事件] 的行銷活動設定頁面。](http://docs.aws.amazon.com/zh_tw/connect/latest/adminguide/images/how-to-create-campaigns-using-event-triggers-1.png)

1. 選取**事件來源**以指定資料的來源位置，並設定將啟用事件觸發程序的屬性條件。

   事件來源以您的 Customer Profiles 網域中的整合為基礎。如需設定外部應用程式的詳細資訊，請參閱[與外部應用程式整合](integrate-external-apps-customer-profiles.md#setup-integrations-title-menu)。您也可以與 [Kinesis](customer-profiles-kinesis-integration.md) 或 [S3](customer-profiles-object-type-mappings.md) 整合。  
![顯示整合選項和屬性條件組態的事件來源選取面板。](http://docs.aws.amazon.com/zh_tw/connect/latest/adminguide/images/how-to-create-campaigns-using-event-triggers-2.png)

1. 選取**交付模式**和其他通訊設定。  
![事件觸發行銷活動的交付模式選取和其他通訊設定。](http://docs.aws.amazon.com/zh_tw/connect/latest/adminguide/images/how-to-create-campaigns-using-event-triggers-3.png)

1. （選用） 設定**建議**區段，將 Predictive Insights 與您的事件觸發行銷活動整合。這可讓您透過電子郵件和簡訊管道交付個人化範本內容。  
![Amazon Connect 主控台中的建議區段，顯示已選取 frequently_paired_items 的推薦者下拉式清單、已針對已選取 _last_interacted_item_id 的推薦者計算屬性、設為 3 的建議數目，以及已選取名稱、價格、描述、ImageLink 和類別的建議屬性。](http://docs.aws.amazon.com/zh_tw/connect/latest/adminguide/images/how-to-create-campaigns-recommendations.png)

   進行下列設定：
   + **建議者名稱** – 選取您要用來為與行銷活動相關聯的設定檔產生建議的建議者名稱。您只能使用作用中的推薦者來產生建議。

     Predictive Insights 提供數種類型的建議。如需詳細資訊，請參閱[步驟 3：建立預測性洞見](predictive-insights-get-started.md#create-predictive-insights)。
   + **建議程式的計算屬性** – 只有在使用*類似項目*或*經常配對的項目*建議程式類型時，才需要此設定。此內容有助於建議引擎了解要根據哪些產品提供建議，為您的客戶提供更相關和有針對性的建議。

     例如，您可以使用類似 的計算屬性`_last_interacted_item_id`來擷取購買項目 ID。
   + **建議數目** – 要為設定檔產生的建議數目上限。這範圍介於 1 到 3 個建議之間。
   + **建議屬性** – 定義要在訊息範本中使用的建議回應屬性。

   如需 Predictive Insights 的詳細資訊，請參閱 [開始使用 Predictive Insights](predictive-insights-get-started.md)。

1. 驗證您的組態，然後選擇**發布**。  
![使用 [發布] 按鈕進行事件觸發行銷活動組態的最終檢閱畫面。](http://docs.aws.amazon.com/zh_tw/connect/latest/adminguide/images/how-to-create-campaigns-using-event-triggers-4.png)

## 使用 API 建立具有事件觸發程序的對外行銷活動
<a name="how-to-create-campaigns-using-event-triggers-api"></a>

**Amazon Connect Customer Profiles 事件觸發程序 API**
+ 進行兩個 API 呼叫來建立可運作的事件觸發程序：
  +  [CreateEventTrigger](https://docs.aws.amazon.com/connect/latest/APIReference/API_connect-customer-profiles_CreateEventTrigger.html)：定義要根據指定條件執行的動作。
  +  [PutIntegration](https://docs.aws.amazon.com/connect/latest/APIReference/API_connect-customer-profiles_PutIntegration.html)：定義要使用的動作。

**事件觸發程序請求的範例：**

```
{
"Description": "string",
"EventTriggerConditions": [
{
"EventTriggerDimensions": [
{
"ObjectAttributes": [
{
"ComparisonOperator": "string",
"FieldName": "string",
"Source": "string",
"Values": [ "string" ]
}
]
}
],
"LogicalOperator": "string"
}
],
"EventTriggerLimits": {
"EventExpiration": number,
"Periods": [
{
"MaxInvocationsPerProfile": number,
"Unit": "string",
"Unlimited": boolean,
"Value": number
}
]
},
"ObjectTypeName": "string",
"SegmentFilter": "string",
"Tags": {
"string" : "string"
}
}
```

**`ComparisonOperator` 支援下列值：**


|  ComparisonOperator  |  Comment  |  支援的類型  | 
| --- | --- | --- | 
|  INCLUSIVE  |  檢查目標是否包含所有指定的值。 |  String  | 
|  獨家  |  檢查目標是否不包含所有指定的值。 |  String  | 
|  CONTAINS  |  檢查目標是否包含任何指定的值。 |  String  | 
|  BEGINS\_WITH  |  檢查目標是否以指定的值開頭。 |  String  | 
|  ENDS\_WITH  |  檢查目標是否以指定的值結尾。 |  String  | 
|  GREATER\_THAN  |  如果目標大於指定的值，則為 True。 |  Number  | 
|  LESS\_THAN  |  如果目標小於指定的值，則為 True。 |  Number  | 
|  GREATER\_THAN\_OR\_EQUAL  |  如果目標大於或等於指定的值，則為 True。 |  Number  | 
|  LESS\_THAN\_OR\_EQUAL  |  如果目標小於或等於指定的值，則為 True。 |  Number  | 
|  EQUAL  |  如果目標等於指定的值，則為 True。 |  Number  | 
|  介於  |  如果目標位於特定值範圍或時間戳記內，則為 True。 |  數字/日期\*  | 
|  NOT\_BETWEEN  |  如果目標不在特定值範圍或時間戳記內，則為 True。 |  數字/日期\*  | 
|  之前  |  如果目標在指定的時間戳記之前，則為 True。 |  Date  | 
|  之後  |  如果目標在指定的時間戳記之後，則為 True。 |  Date  | 
|  ON  |  如果目標位於指定的時間戳記內，則為 True。 |  Date  | 
+ **來源**：用來定義物件中的屬性。
  + 單一 `ObjectAttribute` 項目中只允許一個屬性。
+ **FieldName**：用來指向資料對應中的對應屬性。
  + 單一 `ObjectAttribute` 項目中只允許一個屬性。
+ **ObjectTypeName**：支援所有的預設和自訂物件類型名稱，但不支援標準物件類型，例如 `_profile`、`_asset`、`_order` 等等。
+ **EventTriggerLimits**：
  +  根據預設，每個客戶網域最多允許 20 個並行事件觸發程序。
  +  預設限制為每個設定檔、每個觸發程序每天調用 10 次。您可以在 `MaxInvocationPerProfile` 中指定 `UNLIMITED` 加以覆寫。
  +  **MaxInvocationPerProfile**：
    + 有效範圍：最小值為 1。最大值為 1000。(或 `UNLIMITED`)
  +  單位：
    + 有效值：HOURS、DAYS、WEEKS、MONTHS
  +  值：
    + 有效範圍：最小值為 1。最大值為 24
+  時間範圍比較 
  +  Customer Profiles 會使用標準程式庫來剖析時間值。對於全域服務，請務必考量時區轉換，以確保能精準處理。
+ `EventExpiration` 值的指定以毫秒為單位。用來觸發行銷活動時，最大過期時間上限為 15 分鐘。

**Outbound Campaigns 事件觸發程序 API**
+ **CreateCampaignV2**

  建立事件觸發行銷活動所需的唯一變更，是醒目提示的欄位。其餘欄位皆與排程行銷活動相同。

  ```
  {
      "name": "string",
      "connectInstanceId": "string",
      "channelSubtypeConfig": { 
      // or other channel parameters 
          "email": {
              "outboundMode": {
                  "agentless":{
                  }
              },
              "defaultOutboundConfig":{
                  "connectSourceEmailAddress":"example@example.com",
                  "wisdomTemplateArn":"arn:aws:wisdom:us-west-2:123456789012:message-template/dXXXXX0Pc8-195a-776f-0000-EXAMPLE/51219d5c-b1f4-4bad-b8d3-000673332",
                  "sourceEmailAddressDisplayName": "testEmailDisplayName"
              }
          }
      },
      "connectCampaignFlowArn": {{<Flow ARN>}},
      "schedule": {
              "endTime": "2024-12-11T21:22:00Z",
              "startTime": "2024-10-31T20:14:49Z",
              "timeZone": "America/Los_Angeles"
      },
      "source": {
          "eventTrigger": {
              "customerProfilesDomainArn": {{<Domain ARN>}}
  }
  ```
+ **PutProfileOutboundRequestBatch**

  您無法直接調用此 API，但它會記錄在 Cloudtrail 日誌中。此 API 的用途是在接收到事件後觸發行銷活動，此外也是起始語音通話、電子郵件或 SMS 的機制。