logo
開發者文件
搜尋
Webhook 模式

Webhook 模式

目前 GPTBots Agent 訊息回應模式支援:blockingstreamingwebhook。當開發者使用 webhook 模式 接收回應訊息時,由 Agent 或人工客服提供的訊息內容將提交至指定的 webhook 地址。

請求方法

POST

端點

請在 Agent - Integration - API - webhook 頁面配置您的訊息接收地址。

認證

詳情請參考 API 概覽中的認證方法說明。

請求

請求範例

curl -X POST 'YOUR_API_URL' \ -H 'Authorization: Bearer ${API Key}' \ -H 'Content-Type: application/json' \ -d '{ "message_id": "65a4ccfC7ce58e728d5897e0", "message_type": "ANSWER", "text": "Hi, is there anything I can help you?", "flow_output": [ { "content": "你好", "branch": "1", "from_component_name": "User Input" } ], "create_time": 1679587005, "conversation_id": "657303a8a764d47094874bbe" }'
                      
                      curl -X POST 'YOUR_API_URL' \ 
-H 'Authorization: Bearer ${API Key}' \	
-H 'Content-Type: application/json' \ 
-d '{
  "message_id": "65a4ccfC7ce58e728d5897e0",
  "message_type": "ANSWER",
  "text": "Hi, is there anything I can help you?",
  "flow_output": [
    {
      "content": "你好",
      "branch": "1",
      "from_component_name": "User Input"
    }
  ],
  "create_time": 1679587005,
  "conversation_id": "657303a8a764d47094874bbe"
}'

                    
此代碼塊在浮窗中顯示

請求標頭

欄位 類型 描述
Authorization Bearer 或 Basic ${token} 使用 Authorization: Bearer 或 Basic ${token} 進行認證。您可以從 API Key 頁面獲取 token。
Content-Type application/json 資料類型,值為 application/json。

請求參數

欄位 類型 描述
message_id string 訊息的唯一 ID。
message_type string 訊息類型,值為:ANSWER, QUESTION。
text string 由 Agent 提供的文字內容。
flow_output JSON 陣列 Flow 模式中 Agent 的回應內容。
content string Flow 模式中 Agent 元件的文字回應。
branch string Flow 模式中 Agent 的分支。
from_component_name string Flow 模式中 Agent 的上游元件名稱。
create_time long 回應訊息建立的時間戳。
conversation_id string 對話 ID。

回應

回應範例

{ "code": 200, "msg": "success" }
                      
                      {
  "code": 200,
  "msg": "success"
}

                    
此代碼塊在浮窗中顯示