

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# Amazon Connect Cases が Contact Lens ルールに更新を送信できるようにする
<a name="cases-rules-integration-onboarding"></a>

**注記**  
この手続きの手順を実行するには、デベロッパーのスキル、または Amazon Connect CLI の経験が必要です。

この 1 回限りの手続きを完了すると、ユーザーはケースの作成または更新時に実行されるルールを設定できます。

1. Amazon Connect インスタンスで Amazon Connect Cases が[有効](enable-cases.md)になっていることを確認します。

1. Amazon Connect Cases のイベントストリームを有効にする手順を完了します。詳細については、「[Amazon Connect Cases のイベントストリームの設定](case-event-streams-enable.md)」を参照してください。手順に対する以下の変更に注意してください。

   1. SQS キューの作成が求められる部分は必須ではないため、スキップしてもかまいません。

   1. `put-case-event-configuration` CLI コマンドを実行し、イベントにすべてのケースフィールド情報を含めます。ルールエンジンが動作するのに必要なすべてのフィールドは必ず含めます。
**注記**  
Cases SLA 違反ルールが正しく動作するようにするには、次の例に示すように、`relatedItemData.includeContent` を `true` に設定する必要があります。

      ```
      aws connectcases put-case-event-configuration --domain-id 01310a0e-24ba-4a3c-89e9-9e1daeaxxxx --event-bridge "{
          \"enabled\": true, 
          \"includedData\": {
             \"caseData\": {
                 \"fields\": [
                   {
                     \"id\": \"status\"
                   },
                   {
                     \"id\": \"title\"
                   },
                   {
                     \"id\": \"assigned_queue\"
                   },
                   {
                     \"id\": \"assigned_user\"
                   },
                   {
                     \"id\": \"case_reason\"
                   },
                   {
                     \"id\": \"last_closed_datetime\"
                   },
                   {
                     \"id\": \"created_datetime\"
                   },
                   {
                     \"id\": \"last_updated_datetime\"
                   },
                   {
                     \"id\": \"reference_number\"
                   },
                   {
                     \"id\": \"summary\"
                   }
                 ]
            },
            \"relatedItemData\": {
            \"includeContent\": true
            }
          }
        }"
      ```

   1. カスタムケースフィールドがある場合は、前のペイロードのフィールド配列にもカスタムフィールド ID を含めます。以下の `list-fields` CLI コマンドを実行してフィールド ID を検索できます。

      ```
      aws connectcases list-fields --domain-id 01310a0e-24ba-4a3c-89e9-9e1daeaxxxx
      ```

   1. 新しいカスタムフィールドを追加する必要がある場合は、ステップ 2 を繰り返します。

1. 以下のコマンド例に示すように、[CreateEventIntegration](https://docs.aws.amazon.com/appintegrations/latest/APIReference/API_CreateEventIntegration.html) API コール を実行するか、`create-event-integration` CLI コマンドを実行します。
   + ペイロード:

     ```
     aws appintegrations create-event-integration --name amazon-connect-cases --description amazon-connect-cases --event-filter '{"Source":"aws.cases"}' --event-bridge-bus default
     ```
   + 出力は以下のサンプルのようになります。

     ```
     {
         "EventIntegrationArn": "arn:aws:app-integrations:us-west-2:111222333444:event-integration/amazon-connect-cases"
     }
     ```

1. 次のコマンド例に示すように、[CreateIntegrationAssociation](https://docs.aws.amazon.com/connect/latest/APIReference/API_CreateIntegrationAssociation.html) API コール を実行するか、`create-integration-association` CLI コマンドを実行します。
   + ペイロード:

     `IntegrationArn` はステップ 3 で返される応答です。

     ```
     aws connect create-integration-association --instance-id bba5df5c-6a5f-421f-a81d-9c16402xxxx --integration-type EVENT --integration-arn arn:aws:app-integrations:us-west-2:111222333444:event-integration/amazon-connect-cases --source-type CASES
     ```
   + 出力は、次のサンプルのようになります。

     ```
     {
         "IntegrationAssociationId": "d49048cd-497d-4257-ab5c-8de797a123445",
         "IntegrationAssociationArn": "arn:aws:connect:us-west-2:111222333444:instance/bba5df5c-6a5f-421f-a81d-9c16402bxxxx/integration-association/d49048cd-497d-4257-ab5c-8de797a123445"
     }
     ```

これで、ユーザーはケースの作成または更新時に実行されるルールを作成できるようになりました。