

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

# 啟用聊天後問卷
<a name="enable-post-chat-survey"></a>

聊天後問卷可讓您在聊天對話結束後立即收集終端客戶意見回饋。使用 [StartChatContact](https://docs.aws.amazon.com/connect/latest/APIReference/API_StartChatContact.html) API 中的 **`DisconnectOnCustomerExit`** 參數，您可以在終端客戶中斷連線時設定自動客服人員中斷連線，確保無論哪個參與者先中斷連線，都會一致地觸發中斷連線流程。

## 實作選項
<a name="post-chat-survey-implementation"></a>

有兩種方式可以啟用聊天後問卷：

### 對於自訂聊天小工具
<a name="post-chat-survey-custom-builder"></a>

如果您使用的是自訂聊天實作：

1. 升級至最新版本的 [amazon-connect-chatjs](https://github.com/amazon-connect/amazon-connect-chatjs)。

1. 將 `DisconnectOnCustomerExit` 參數新增至您的 [StartChatContact](https://docs.aws.amazon.com/connect/latest/APIReference/API_StartChatContact.html) API 請求：

   ```
   {
       "DisconnectOnCustomerExit": ["AGENT"],
       // ... other StartChatContact parameters
   }
   ```

### 對於 Amazon Connect 通訊小工具
<a name="post-chat-survey-communication-widget"></a>

如果您使用的是 Amazon Connect Communication Widget：

1. 開啟 Amazon Connect 主控台並導覽至**通訊小工具**。

1. 透過通訊小工具頁面啟用聊天後問卷設定。  
![顯示聊天後問卷選項的通訊小工具設定頁面。](http://docs.aws.amazon.com/zh_tw/connect/latest/adminguide/images/post-chat-survey-communication-widget.png)

## 更新聯絡流程，將聊天後問卷新增為中斷連線流程
<a name="post-chat-survey-disconnect-flow"></a>

若要啟用聊天後問卷，您需要更新連線至聊天解決方案的中斷連線流程。設定完成後，問卷會在客戶結束聊天工作階段時自動觸發。

如需建立中斷連線流程的詳細資訊，請參閱 [聊天案例範例](web-and-mobile-chat.md#example-chat-scenario)。

有兩種方式可在中斷連線流程中實作問卷：
+ **選項 1：使用 ShowView 區塊** - 使用 [Amazon Connect 中的流程區塊：顯示檢視](show-view-block.md)顯示自訂問卷界面。
+ **選項 2：使用 Lex** - 與 Amazon Lex 整合以收集文字型問卷。如需詳細資訊，請參閱[將 Amazon Lex 機器人新增到 Amazon Connect](amazon-lex.md)。

**注意**  
對於主管插斷提示案例，請確保在**轉接至佇列**之前新增[Amazon Connect 中的流程區塊：設定工作佇列](set-working-queue.md)區塊。省略它會導致聊天聯絡人終止，而不是傳輸此功能。  

![顯示為主管插斷案例轉接至佇列之前設定工作佇列區塊的流程圖。](http://docs.aws.amazon.com/zh_tw/connect/latest/adminguide/images/post-chat-survey-set-working-queue-block.png)


**聯絡追蹤記錄**  
當客戶結束聊天工作階段時，Amazon Connect 會在 `CUSTOMER_DISCONNECT`中`disconnectReason`將 設定為 [ContactTraceRecord](ctr-data-model.md#ctr-ContactTraceRecord)。設定 `DisconnectOnCustomerExit` 時，系統會產生新的聯絡人 ID (`nextContactId`)，並啟動設定的中斷連線流程。  
範例：  

```
{
    "contactId": "104c05e3-abscdfre",
    "nextContactId": "4cbae06d-ca5b-1234567",
    "channel": "CHAT",
    "initiationMethod": "DISCONNECT",
    "disconnectReason": "CUSTOMER_DISCONNECT"
}
```
[聯絡屬性在 Amazon Connect 中的運作方式](what-is-a-contact-attribute.md) 將在聯絡搜尋和聯絡詳細資訊中更新 。  

![顯示聊天後問卷聯絡屬性的聯絡詳細資訊。](http://docs.aws.amazon.com/zh_tw/connect/latest/adminguide/images/post-chat-survey-contact-attributes.png)


## 其他資源
<a name="post-chat-survey-additional-resources"></a>
+ [StartChatContact API](https://docs.aws.amazon.com/connect/latest/APIReference/API_StartChatContact.html)
+ [Amazon Connect 中第一次聯絡體驗的範例撥入流程](sample-inbound-flow.md)
+ [聊天案例範例](web-and-mobile-chat.md#example-chat-scenario)
+ [Amazon Connect 中的流程區塊：設定工作佇列](set-working-queue.md)
+ [Amazon Connect 中的流程區塊：轉接至佇列](transfer-to-queue.md)
+ [Amazon Connect ShowView](https://docs.aws.amazon.com/connect/latest/adminguide/show-view-block.html)
+ [Amazon Connect 搭配 Lex](https://docs.aws.amazon.com/connect/latest/adminguide/amazon-lex.html)
+ [聯絡屬性在 Amazon Connect 中的運作方式](what-is-a-contact-attribute.md)