Dialogflow CX 的自訂酬載可讓您在純文字對話和互動之外,進一步提升虛擬服務專員體驗。在 Dialogflow CX 中使用自訂酬載,即可將虛擬服務專員設為顯示自訂回應和引文。
自訂回覆訊息類型
自訂回應可讓您顯示下列訊息類型:
文字
內嵌按鈕
按鈕會卡住
圖片
影片
文件
複雜檢視畫面 (一或多種訊息類型組合)
自訂動作可讓虛擬服務專員執行下列動作:
轉介給真人服務專員
預計轉介給真人服務專員
結束支援工作階段
Contact Center AI 平台 (CCAI 平台) 酬載
在 Dialogflow CX 中做為自訂酬載使用。以下範例說明如何使用 Dialogflow CX,在 Web SDK 中取得回應。
{ "ujet": { "type": "text|inline_button|sticky_button|image|video|document|complex|action", "action": "escalation|end", "title": "message displayed on the top of the message", "escalation_reason": "by_consumer|by_virtual_agent", "session_variable": { "capture_target": "payload|end_user_response", "capture_key": "key", "payload": { } }, "messages": [ "Hello", "How can I help you?" ], "buttons": [ { "title": "Button 1", "action": "quick_reply" }, { "title": "Button 2", "action": "quick_reply" } ], "images": [ { "url": "https://image.url", "text": "an alternate text for an image for when failed to load an image" }, { "url": "https://image.url", "text": "an alternate text for an image" } ], "videos": [ { "url": "https://video.url", "text": "an alternate text for a video for when failed to load a video" }, { "url": "https://video.url", "text": "an alternate text for a video" } ], "documents": [ { "url": "https://document.url", "text": "an alternate text for a document for when failed to load a document" }, { "url": "https://document.url", "text": "an alternate text for a document" } ], "components": [ { "type": "text", "messages": [ "We need the information for helping you.", "Could you please choose the following options?" ] }, { "type": "inline_button", "buttons": [ { "title": "Button 1", "action": "quick_reply" }, { "title": "Button 2", "action": "quick_reply" } ] }, { "type": "image", "images": [ { "url": "https://image.url", "text": "an alternate text for an image for when failed to load an image" }, { "url": "https://image.url", "text": "an alternate text for an image" } ] } ] } }
自訂酬載的即時通訊訊息格式
與 CCAI Platform SDK 搭配使用,可顯示適當的 UI。這與 Dialogflow CX 自訂酬載格式相同,但根目錄中沒有「ujet」欄位。
詳情請參閱下列範例。
範例
以下各節包含可在 Dialogflow CX 中使用的酬載範例。
文字
{
"ujet": {
"type": "text",
"messages": [
"Hello",
"How can I help you?"
]
}
}
轉送至相同佇列
透過虛擬服務專員:
{
"ujet": {
"type": "action",
"action": "escalation",
"escalation_reason": "by_virtual_agent"
}
}
依據終端使用者:
{
"ujet": {
"type": "action",
"action": "escalation",
"escalation_reason": "by_consumer"
}
}
資訊主頁會顯示 escalation_reason 值。
將案件轉送至目標佇列
透過虛擬服務專員:
{
"ujet": {
"type": "action",
"action": "escalation",
"escalation_reason": "by_virtual_agent",
"menu_id": 100,
"language": "ko"
}
}
依據終端使用者:
{
"ujet": {
"type": "action",
"action": "escalation",
"escalation_reason": "by_consumer",
"menu_id": 100,
"language": "ko"
}
}
資訊主頁會顯示 escalation_reason 值。
結束對話
{
"ujet": {
"type": "action",
"action": "end"
}
}
內嵌按鈕
{
"ujet": {
"type": "inline_button",
"title": "Select a menu",
"buttons": [
{
"title": "Lorem Ipsum",
"action": "quick_reply"
},
{
"title": "Lorem Ipsum Dolor Sit Amet",
"action": "escalation"
}
]
}
}
範例

固定按鈕
{
"ujet": {
"type": "sticky_button",
"title": "Select a menu",
"buttons": [
{
"title": "Lorem Ipsum",
"action": "quick_reply"
},
{
"title": "Lorem Ipsum Dolor Sit Amet",
"action": "escalation"
}
]
}
}
範例

圖片檢視畫面
{
"ujet": {
"type": "image",
"title": "Please see the following images",
"images": [
{
"url": "https://image1.url",
"text": "an alternate text for an image for when failed to load an image"
},
{
"url": "https://image2.url",
"text": "an alternate text for an image"
}
]
}
}
觀看影片
{
"ujet": {
"type": "video",
"title": "Please see the following videos",
"videos": [
{
"url": "https://video1.url",
"text": "an alternate text for a video for when failed to load a video"
},
{
"url": "https://video2.url",
"text": "an alternate text for a video"
}
]
}
}
檢視文件
{
"ujet": {
"type": "document",
"title": "Please see the following document",
"documents": [
{
"url": "https://document1.url",
"text": "an alternate text for a document for when failed to load a document"
},
{
"url": "https://document2.url",
"text": "an alternate text for a document"
}
]
}
}
複雜檢視畫面
{
"ujet": {
"type": "complex",
"type": "Welcome to CCAI Platform world!",
"components": [
{
"type": "text",
"messages": [
"We need the information for helping you.",
"Could you please choose the following options?"
]
},
{
"type": "inline_button",
"buttons": [
{
"title": "Button 1",
"action": "quick_reply"
},
{
"title": "Button 2",
"action": "quick_reply"
}
]
},
{
"type": "image",
"images": [
{
"url": "https://image1.url",
"text": "an alternate text for an image for when failed to load an image"
},
{
"url": "https://image2.url",
"text": "an alternate text for an image"
}
]
}
]
}
}
在 Dialogflow 中設定自訂酬載
如要進一步瞭解如何使用 Dialogflow 設定自訂酬載,請參閱「自訂酬載回應」(Dialogflow ES) 或「自訂酬載」(Dialogflow CX) 資源。
詳情請參閱「自訂工作階段變數,處理自訂酬載」。
虛擬服務專員將通話轉接至電話號碼或 SIP 端點
您可以使用 Dialogflow CX 自訂酬載,將通話從語音虛擬服務專員轉接至您指定的電話號碼或 SIP 端點。如果連線成功,虛擬服務專員就會從通話中移除,通話會繼續進行。如果連線失敗,系統會播放轉接失敗訊息,並繼續與虛擬服務專員通話。
虛擬服務專員可轉接內部和外部通話。虛擬服務專員轉接會記錄為報表中的 Planned Transfers。
將通話轉接至電話號碼
如要將通話從虛擬服務專員轉接至電話號碼,請使用類似下列程式碼範例的 Dialogflow CX 酬載:
{
"ujet": {
"type": "action",
"action": "deflection",
"deflection_type" : "phone",
"phone_number": "+16509424879"
}
}
將通話轉接至 SIP 端點
如要以標準方式將通話從虛擬服務專員轉接至 SIP 端點,請使用類似下列程式碼範例的 Dialogflow CX 酬載:
{
"ujet": {
"type": "action",
"action": "deflection",
"deflection_type" : "sip",
"sip_uri": "sip:1-999-123-4567@voip-provider.example.net"
}
}
使用 SIP REFER 方法將通話轉接至 SIP 端點
如要使用 SIP REFER 方法將通話從虛擬服務專員轉接至 SIP 端點,請使用類似於下列程式碼範例的 Dialogflow CX 酬載。您可以使用 SIP REFER 方法,透過標頭屬性傳遞實用資訊。
{
"ujet": {
"type": "action",
"action": "deflection",
"deflection_type" : "sip"
"sip_uri": "sip:1-999-123-4567@voip-provider.example.net"
"sip_refer": true
"sip_parameters": {
"x-header": "value",
"x-header": "value"
}
}
}
自訂工作階段變數,用於處理自訂酬載
使用自訂工作階段變數擷取意圖回應和使用者回應中的值,然後收集所有值並上傳至 CRM 做為註解。詳情請參閱「自訂工作階段變數的 Dialogflow 酬載」。
從使用者回應擷取
Flow
CCAI Platform 會向 Dialogflow CX 要求回應。
Dialogflow CX 可能會透過執行要求回呼客戶的伺服器。
客戶的伺服器應在回應中填寫 session_variable 欄位。
Dialogflow CX 會傳回包含自訂酬載的回應,包括 capture_target =
end_user_response的session_variable欄位。使用者傳送訊息。
CCAI Platform 會保留上一步傳送的使用者訊息。
虛擬服務專員離開對話時,CCAI Platform 會將對話中擷取的所有工作階段變數,以註解的形式發布至 CRM。
自訂酬載格式
{
"ujet": {
"session_variable": {
"capture_target": "end_user_response",
"capture_key": "key"
}
}
}
虛擬服務專員傳送自訂酬載後,下一個使用者訊息會立即擷取為工作階段變數,並以「key」做為鍵。
從意圖回應擷取
Flow
CCAI Platform 會向 Dialogflow CX 要求回應。
Dialogflow CX 可能會透過 Fulfillment 將其回呼至客戶的伺服器。
顧客的伺服器應在回應中填寫
session_variable欄位。
Dialogflow CX 會傳回包含自訂酬載的回應,包括含有
capture_target = "payload"的session_variable欄位。CCAI 平台伺服器會在步驟 2 中保留
payload物件。
虛擬服務專員離開即時通訊時,CCAI 平台會將即時通訊工作階段中擷取的所有工作階段變數,以註解形式發布至 CRM。
自訂酬載格式
{
"ujet": {
"session_variable": {
"capture_target": "payload",
"capture_type": [
"comment",
"agent"
],
"payload": {
"status": "STATUS",
"order_id": "ORDER_ID",
"personal_id": "PERSONAL_ID"
},
"invisible_to_agent": ["INVISIBLE_TO_AGENT"],
"display_order_in_adapter": ["DISPLAY_ORDER_IN_ADAPTER"]
}
}
}
更改下列內容:
STATUS:訂單狀態ORDER_ID:訂單 IDPERSONAL_ID:終端使用者的 ID。INVISIBLE_TO_AGENT:您不想在代理程式轉接器中顯示的屬性陣列。舉例來說,如果這裡的值為"personal_id",代理程式介面就不會顯示personal_id屬性。詳情請參閱「顯示虛擬代理程式工作階段變數」。DISPLAY_ORDER_IN_ADAPTER:屬性陣列,用於指定工作階段變數在服務專員介面和 CRM 記錄中的顯示順序。詳情請參閱「顯示虛擬代理程式工作階段變數」。
在 CRM 上傳自訂工作階段變數
伺服器應收集每個工作階段變數的所有工作階段變數,然後在虛擬服務專員離開時上傳至 CRM。
客戶關係管理系統訊息範例
###########################
Chat ID: 1
Menu ID: 1
Chatbot Platform: Platform Name
Chatbot Workflow: Workflow Name
Virtual Agent: Virtual Agent Name
###########################
Intent: Intent Captured from End User Response
Captured At: 2020-06-25 14:54:19
Captured Variables
request: Cancel Order
###########################
Intent: Intent Captured from Payload
Captured At: 2020-06-25 14:58:23
Captured Variables
status: Cancelled
order_id: #12345
###########################
範例情境
以下是範例對話,顯示虛擬服務專員與使用者之間的互動步驟和訊息。
步驟 1
虛擬服務專員的即時通訊訊息
How can I help you?
(Button) Show my orders
(Button) Cancel an order
意圖回應 (自訂酬載)
{
"ujet": {
"type": "inline_button",
"title": "How can I help you?",
"buttons": [
{
"title": "Show my orders",
"action": "quick_reply"
},
{
"title": "Cancel an order",
"action": "quick_reply"
}
]
}
}
擷取的工作階段變數
無
步驟 2
使用者傳送的即時通訊訊息
Click "Cancel an order" button.
擷取的工作階段變數
無
步驟 3
虛擬服務專員的即時通訊訊息
Can you provide the order id please
意圖回應 (自訂酬載)
{
"ujet": {
"type": "text"
"messages": [
"Can you provide the order id please"
],
"session_variable": {
"capture_target": "end_user_response",
"capture_key": "order_id";
}
}
}
擷取的工作階段變數
無
步驟 4
使用者傳送的即時通訊訊息
Order id is #12345
擷取的工作階段變數
order_id: "Order ID is #12345"
步驟 5
虛擬服務專員的即時通訊訊息
Order #12345 is cancelled.
Do you need anything else?
意圖回應 (自訂酬載)
{
"ujet": {
"type": "text",
"messages": [
"Order #12345 is canceled.",
"Do you need anything else?"
],
"session_variable": {
"capture_target": "payload",
"capture_type": [
"agent",
"comment",
"event"
],
"payload": {
"order_id": "#12345",
"order_status": "cancelled"
}
}
}
}
擷取的工作階段變數
order_id: "#12345",
order_status: canceled
步驟 6
使用者傳送的即時通訊訊息
I would like to speak with a human agent.
步驟 7
虛擬服務專員的即時通訊訊息
Virtual Agent is left from the conversation.
{
"ujet": {
"type": "escalation",
"escalation_reason": "by_consumer"
}
}
在 CRM 上傳自訂工作階段變數
根據上一個情境,CRM 服務單上會顯示下列留言:
---------------------------------
Chat ID: 1
Menu ID: 1
Chatbot Platform: Platform Name
Chatbot Workflow: Workflow Name
Virtual Agent: Virtual Agent Name
--------------------------------
Intent: Intent Captured from End User Response
Captured At: 2020-06-25 14:54:19
Captured Variables
order_id: Order id is #12345.
--------------------------------
Intent: Intent Captured from Payload
Captured At: 2020-06-25 14:58:23
Captured Variables
order_id: #12345
order_status: canceled
--------------------------------
設定內容資訊卡
內容資訊卡會以資訊卡格式顯示簡潔且吸引人的內容,方便使用者與呈現的資訊互動。你可以使用 Dialogflow CX 建立內容資訊卡,並透過標題、副標題和內文自訂資訊卡。
以下範例使用內容資訊卡向使用者顯示餐廳選項:

內容資訊卡屬性
| 屬性名稱 | 說明 | 必填 | 類型 |
|---|---|---|---|
title |
資訊卡的標題。 | 是 | 字串 |
subtitle |
資訊卡的副標題。 | 否 | 字串 |
body |
內容資訊卡的說明。 | 是 | 字串 |
link |
網頁連結或深層連結。SDK 會使用 OS 功能開啟該網址。 | 否 | 字串 |
event_params |
包含點擊事件額外資訊的字典。SDK 會使用這個值。 | 否 | 字典 |
Dialogflow CX 酬載:新增驗證並接受內容卡片類型
透過聊天機器人伺服器收到終端使用者傳送的訊息時,特定 Dialogflow CX 酬載類型會處理內容資訊卡。以下是 Dialogflow CX 酬載的範例:
{
"ujet": {
"type": "content_card",
"cards": [
{
"title": "Title",
"subtitle": "Subtitle",
"body": "Body",
"link": "app://page",
"event_params": {} # for deep-link click event
}
]
}
}
客戶關係管理系統對話記錄中的內容資訊卡
系統會記錄資訊卡標題資訊,追蹤使用者點選的資訊卡。這項資訊會記錄在 CRM 的即時通訊記錄中。
在下列範例中,CRM 中的即時通訊訊息記錄會顯示內容資訊卡互動。
[Chat message history]
ID: 305 | 2023-07-06 PDT
--------------------------------------------------
[01:13:32 VA] Welcome message
[01:14:35 Mobile U.] Content Cards:
- Title 1
- Title 2
記錄內容資訊卡標題點擊事件
如要記錄使用者點選內容資訊卡標題的動作,請使用下列格式擷取事件:
{end_user_name} clicked on the '{title}' card.
Note Title: Content Card click
Note Comment: 'John Doe' clicked on the 'See our new website' card.
使用 End User Event API 建立內容資訊卡點擊事件
當使用者點選內容資訊卡的標題時,您可以將 POST 要求連同點選的資訊卡標題傳送至指定網址,記錄這項事件。
API 端點: POST /api/v2/chat/:id/end_user_event
用法:建立內容資訊卡點擊事件。
網址: /api/v2/chats/:id/end_user_event
方法: POST
參數:
| 欄位 | 類型 | 說明 |
|---|---|---|
event |
物件 | |
event.name |
字串 | 如要使用內容資訊卡點擊事件,請使用 content_card_clicked。 |
event.payload |
物件 | |
event.payload.title |
字串 | 輸入所點選資訊卡的標題。 |
(選用) end_user_name |
字串 | 輸入終端使用者的名稱。如果留空,系統會從 CRM 擷取名稱。 |
要求範例:
{
"event": {
"name": "content_card_clicked",
"payload": {
"title": "New our website"
}
},
"end_user_name": "consumer 1" ## optional
}
回應:Status: 202 Accepted