嵌入式組件
創建 Iframe 組件
創建一個新的可嵌入聊天組件配置,並將其關聯到某個 API 密鑰。
POST
/
api
/
v1
/
iframes
創建 Iframe 組件
curl --request POST \
--url https://api.example.com/api/v1/iframes \
--header 'Content-Type: application/json' \
--data '
{
"api_key_id": "<string>",
"name": "<string>",
"appearance": {},
"behavior": {},
"security": {}
}
'import requests
url = "https://api.example.com/api/v1/iframes"
payload = {
"api_key_id": "<string>",
"name": "<string>",
"appearance": {},
"behavior": {},
"security": {}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
api_key_id: '<string>',
name: '<string>',
appearance: {},
behavior: {},
security: {}
})
};
fetch('https://api.example.com/api/v1/iframes', 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",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'api_key_id' => '<string>',
'name' => '<string>',
'appearance' => [
],
'behavior' => [
],
'security' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/iframes"
payload := strings.NewReader("{\n \"api_key_id\": \"<string>\",\n \"name\": \"<string>\",\n \"appearance\": {},\n \"behavior\": {},\n \"security\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/v1/iframes")
.header("Content-Type", "application/json")
.body("{\n \"api_key_id\": \"<string>\",\n \"name\": \"<string>\",\n \"appearance\": {},\n \"behavior\": {},\n \"security\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/iframes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"api_key_id\": \"<string>\",\n \"name\": \"<string>\",\n \"appearance\": {},\n \"behavior\": {},\n \"security\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "<string>",
"status": "<string>",
"embed_snippet": "<string>"
}請求
string
必填
要關聯此組件的 API 密鑰 ID。該組件將使用此密鑰的額度、Brand Soul 以及允許的來源域名。
string
組件的顯示名稱。默認值:
"My Widget"。object
外觀自定義設置:
primaryColor、position(bottom-right | bottom-left)、borderRadius、fontFamily,以及自定義 CSS 覆蓋項。object
行為設置:
welcomeMessage、placeholder、maxPromptLength、enableFileUpload、enableVoice、strictAbuse(啓用限流啓發式策略)。object
安全設置:
requireTurnstile(機器人防護)、allowedOrigins(覆蓋允許的來源域名白名單)。響應
string
組件配置的 UUID。在嵌入腳本中將其用作
configId。string
組件的顯示名稱。
string
"active" 或 "disabled"。string
可直接使用的 HTML
<script> 標籤,用於嵌入到你的網站中。身份驗證
需要儀表盤會話。示例
curl
curl -X POST https://www.hitheo.ai/api/v1/iframes \
-H "Authorization: Bearer $THEO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"api_key_id": "key_abc123",
"name": "Support Widget",
"appearance": { "primaryColor": "#715eac" },
"behavior": { "welcomeMessage": "Hi! How can I help?", "strictAbuse": true }
}'
這個頁面有幫助嗎?
創建 Iframe 組件
curl --request POST \
--url https://api.example.com/api/v1/iframes \
--header 'Content-Type: application/json' \
--data '
{
"api_key_id": "<string>",
"name": "<string>",
"appearance": {},
"behavior": {},
"security": {}
}
'import requests
url = "https://api.example.com/api/v1/iframes"
payload = {
"api_key_id": "<string>",
"name": "<string>",
"appearance": {},
"behavior": {},
"security": {}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
api_key_id: '<string>',
name: '<string>',
appearance: {},
behavior: {},
security: {}
})
};
fetch('https://api.example.com/api/v1/iframes', 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",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'api_key_id' => '<string>',
'name' => '<string>',
'appearance' => [
],
'behavior' => [
],
'security' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/iframes"
payload := strings.NewReader("{\n \"api_key_id\": \"<string>\",\n \"name\": \"<string>\",\n \"appearance\": {},\n \"behavior\": {},\n \"security\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/v1/iframes")
.header("Content-Type", "application/json")
.body("{\n \"api_key_id\": \"<string>\",\n \"name\": \"<string>\",\n \"appearance\": {},\n \"behavior\": {},\n \"security\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/iframes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"api_key_id\": \"<string>\",\n \"name\": \"<string>\",\n \"appearance\": {},\n \"behavior\": {},\n \"security\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "<string>",
"status": "<string>",
"embed_snippet": "<string>"
}