嵌入式組件
獲取小組件對話
單個小組件會話的完整消息記錄,包括客服(operator)消息。
GET
/
api
/
v1
/
iframes
/
{id}
/
conversations
/
{sessionId}
獲取小組件對話
curl --request GET \
--url https://api.example.com/api/v1/iframes/{id}/conversations/{sessionId}import requests
url = "https://api.example.com/api/v1/iframes/{id}/conversations/{sessionId}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/v1/iframes/{id}/conversations/{sessionId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/iframes/{id}/conversations/{sessionId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/iframes/{id}/conversations/{sessionId}"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/api/v1/iframes/{id}/conversations/{sessionId}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/iframes/{id}/conversations/{sessionId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"session": {},
"messages": [
{}
]
}身份驗證
需要提供 Bearer 令牌(API 密鑰)或儀表盤會話。路徑參數
string
必填
小組件配置的 UUID。
string
必填
會話的 UUID。
響應
object
會話元數據:
id、visitor_id、ip_country、city、page_url、referrer_url、started_at、ended_at、last_seen_at、message_count、lead_captured、lead_data、duration_seconds、takeover_status、taken_over_by、taken_over_at、last_operator_message_at。array
按順序排列的消息記錄。每條消息包含:
id、role(user、assistant 或 operator)、content、mode、resolved_mode、cost_cents、operator_user_id、created_at。示例
curl
curl https://www.hitheo.ai/api/v1/iframes/CONFIG_ID/conversations/SESSION_ID \
-H "Authorization: Bearer $THEO_API_KEY"
這個頁面有幫助嗎?
獲取小組件對話
curl --request GET \
--url https://api.example.com/api/v1/iframes/{id}/conversations/{sessionId}import requests
url = "https://api.example.com/api/v1/iframes/{id}/conversations/{sessionId}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/v1/iframes/{id}/conversations/{sessionId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/iframes/{id}/conversations/{sessionId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/iframes/{id}/conversations/{sessionId}"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/api/v1/iframes/{id}/conversations/{sessionId}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/iframes/{id}/conversations/{sessionId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"session": {},
"messages": [
{}
]
}