위젯 생성
draft 상태의 위젯을 생성합니다. public_id는 서버가 발급합니다. 본문의 status와 published_*는 무시됩니다.
curl --request POST \
--url https://client-api.tryvox.co/v3/widgets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agent": {
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"agent_version": "current"
},
"mode": "chat",
"callback_from_number": "<string>",
"callback_presentation_number": "<string>",
"allowed_domains": [
"<string>"
],
"rate_limit": {
"per_minute": 123
},
"branding": {
"title": "<string>",
"accent_color": "<string>",
"orb_colors": {
"primary": "<string>",
"secondary": "<string>"
},
"styles": {
"button_radius": 123,
"input_radius": 123,
"bubble_radius": 123
},
"logo_url": "<string>",
"popup_message": "<string>",
"popup_delay_seconds": 1,
"auto_open": true,
"suggested_replies": [
"<string>"
],
"disclaimer_text": "<string>",
"markdown": true,
"link_allowed_hosts": [
"<string>"
],
"transcript": true,
"fab_text": "<string>",
"white_label": true,
"dynamic_variables": {},
"terms_url": "<string>",
"callback_fields": [
{
"key": "<string>",
"label": "<string>",
"placeholder": "<string>",
"required": true,
"options": [
"<string>"
]
}
]
}
}
'import requests
url = "https://client-api.tryvox.co/v3/widgets"
payload = {
"agent": {
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"agent_version": "current"
},
"mode": "chat",
"callback_from_number": "<string>",
"callback_presentation_number": "<string>",
"allowed_domains": ["<string>"],
"rate_limit": { "per_minute": 123 },
"branding": {
"title": "<string>",
"accent_color": "<string>",
"orb_colors": {
"primary": "<string>",
"secondary": "<string>"
},
"styles": {
"button_radius": 123,
"input_radius": 123,
"bubble_radius": 123
},
"logo_url": "<string>",
"popup_message": "<string>",
"popup_delay_seconds": 1,
"auto_open": True,
"suggested_replies": ["<string>"],
"disclaimer_text": "<string>",
"markdown": True,
"link_allowed_hosts": ["<string>"],
"transcript": True,
"fab_text": "<string>",
"white_label": True,
"dynamic_variables": {},
"terms_url": "<string>",
"callback_fields": [
{
"key": "<string>",
"label": "<string>",
"placeholder": "<string>",
"required": True,
"options": ["<string>"]
}
]
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agent: {agent_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a', agent_version: 'current'},
mode: 'chat',
callback_from_number: '<string>',
callback_presentation_number: '<string>',
allowed_domains: ['<string>'],
rate_limit: {per_minute: 123},
branding: {
title: '<string>',
accent_color: '<string>',
orb_colors: {primary: '<string>', secondary: '<string>'},
styles: {button_radius: 123, input_radius: 123, bubble_radius: 123},
logo_url: '<string>',
popup_message: '<string>',
popup_delay_seconds: 1,
auto_open: true,
suggested_replies: ['<string>'],
disclaimer_text: '<string>',
markdown: true,
link_allowed_hosts: ['<string>'],
transcript: true,
fab_text: '<string>',
white_label: true,
dynamic_variables: {},
terms_url: '<string>',
callback_fields: [
{
key: '<string>',
label: '<string>',
placeholder: '<string>',
required: true,
options: ['<string>']
}
]
}
})
};
fetch('https://client-api.tryvox.co/v3/widgets', 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://client-api.tryvox.co/v3/widgets",
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([
'agent' => [
'agent_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'agent_version' => 'current'
],
'mode' => 'chat',
'callback_from_number' => '<string>',
'callback_presentation_number' => '<string>',
'allowed_domains' => [
'<string>'
],
'rate_limit' => [
'per_minute' => 123
],
'branding' => [
'title' => '<string>',
'accent_color' => '<string>',
'orb_colors' => [
'primary' => '<string>',
'secondary' => '<string>'
],
'styles' => [
'button_radius' => 123,
'input_radius' => 123,
'bubble_radius' => 123
],
'logo_url' => '<string>',
'popup_message' => '<string>',
'popup_delay_seconds' => 1,
'auto_open' => true,
'suggested_replies' => [
'<string>'
],
'disclaimer_text' => '<string>',
'markdown' => true,
'link_allowed_hosts' => [
'<string>'
],
'transcript' => true,
'fab_text' => '<string>',
'white_label' => true,
'dynamic_variables' => [
],
'terms_url' => '<string>',
'callback_fields' => [
[
'key' => '<string>',
'label' => '<string>',
'placeholder' => '<string>',
'required' => true,
'options' => [
'<string>'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://client-api.tryvox.co/v3/widgets"
payload := strings.NewReader("{\n \"agent\": {\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"agent_version\": \"current\"\n },\n \"mode\": \"chat\",\n \"callback_from_number\": \"<string>\",\n \"callback_presentation_number\": \"<string>\",\n \"allowed_domains\": [\n \"<string>\"\n ],\n \"rate_limit\": {\n \"per_minute\": 123\n },\n \"branding\": {\n \"title\": \"<string>\",\n \"accent_color\": \"<string>\",\n \"orb_colors\": {\n \"primary\": \"<string>\",\n \"secondary\": \"<string>\"\n },\n \"styles\": {\n \"button_radius\": 123,\n \"input_radius\": 123,\n \"bubble_radius\": 123\n },\n \"logo_url\": \"<string>\",\n \"popup_message\": \"<string>\",\n \"popup_delay_seconds\": 1,\n \"auto_open\": true,\n \"suggested_replies\": [\n \"<string>\"\n ],\n \"disclaimer_text\": \"<string>\",\n \"markdown\": true,\n \"link_allowed_hosts\": [\n \"<string>\"\n ],\n \"transcript\": true,\n \"fab_text\": \"<string>\",\n \"white_label\": true,\n \"dynamic_variables\": {},\n \"terms_url\": \"<string>\",\n \"callback_fields\": [\n {\n \"key\": \"<string>\",\n \"label\": \"<string>\",\n \"placeholder\": \"<string>\",\n \"required\": true,\n \"options\": [\n \"<string>\"\n ]\n }\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://client-api.tryvox.co/v3/widgets")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agent\": {\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"agent_version\": \"current\"\n },\n \"mode\": \"chat\",\n \"callback_from_number\": \"<string>\",\n \"callback_presentation_number\": \"<string>\",\n \"allowed_domains\": [\n \"<string>\"\n ],\n \"rate_limit\": {\n \"per_minute\": 123\n },\n \"branding\": {\n \"title\": \"<string>\",\n \"accent_color\": \"<string>\",\n \"orb_colors\": {\n \"primary\": \"<string>\",\n \"secondary\": \"<string>\"\n },\n \"styles\": {\n \"button_radius\": 123,\n \"input_radius\": 123,\n \"bubble_radius\": 123\n },\n \"logo_url\": \"<string>\",\n \"popup_message\": \"<string>\",\n \"popup_delay_seconds\": 1,\n \"auto_open\": true,\n \"suggested_replies\": [\n \"<string>\"\n ],\n \"disclaimer_text\": \"<string>\",\n \"markdown\": true,\n \"link_allowed_hosts\": [\n \"<string>\"\n ],\n \"transcript\": true,\n \"fab_text\": \"<string>\",\n \"white_label\": true,\n \"dynamic_variables\": {},\n \"terms_url\": \"<string>\",\n \"callback_fields\": [\n {\n \"key\": \"<string>\",\n \"label\": \"<string>\",\n \"placeholder\": \"<string>\",\n \"required\": true,\n \"options\": [\n \"<string>\"\n ]\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://client-api.tryvox.co/v3/widgets")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agent\": {\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"agent_version\": \"current\"\n },\n \"mode\": \"chat\",\n \"callback_from_number\": \"<string>\",\n \"callback_presentation_number\": \"<string>\",\n \"allowed_domains\": [\n \"<string>\"\n ],\n \"rate_limit\": {\n \"per_minute\": 123\n },\n \"branding\": {\n \"title\": \"<string>\",\n \"accent_color\": \"<string>\",\n \"orb_colors\": {\n \"primary\": \"<string>\",\n \"secondary\": \"<string>\"\n },\n \"styles\": {\n \"button_radius\": 123,\n \"input_radius\": 123,\n \"bubble_radius\": 123\n },\n \"logo_url\": \"<string>\",\n \"popup_message\": \"<string>\",\n \"popup_delay_seconds\": 1,\n \"auto_open\": true,\n \"suggested_replies\": [\n \"<string>\"\n ],\n \"disclaimer_text\": \"<string>\",\n \"markdown\": true,\n \"link_allowed_hosts\": [\n \"<string>\"\n ],\n \"transcript\": true,\n \"fab_text\": \"<string>\",\n \"white_label\": true,\n \"dynamic_variables\": {},\n \"terms_url\": \"<string>\",\n \"callback_fields\": [\n {\n \"key\": \"<string>\",\n \"label\": \"<string>\",\n \"placeholder\": \"<string>\",\n \"required\": true,\n \"options\": [\n \"<string>\"\n ]\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"public_id": "<string>",
"organization_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"agent": {
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"agent_version": "current"
},
"status": "draft",
"mode": "chat",
"callback_from_number": "<string>",
"callback_presentation_number": "<string>",
"allowed_domains": [
"<string>"
],
"rate_limit": {
"preset": "standard",
"per_minute": 123
},
"branding": {
"title": "<string>",
"accent_color": "<string>",
"orb_colors": {
"primary": "<string>",
"secondary": "<string>"
},
"styles": {
"button_radius": 123,
"input_radius": 123,
"bubble_radius": 123
},
"theme": "light",
"logo_url": "<string>",
"popup_message": "<string>",
"popup_delay_seconds": 123,
"auto_open": true,
"suggested_replies": [
"<string>"
],
"disclaimer_text": "<string>",
"markdown": true,
"link_allowed_hosts": [
"<string>"
],
"transcript": true,
"fab_text": "<string>",
"placement": "bottom-right",
"panel_size": "compact",
"white_label": true,
"dynamic_variables": {},
"terms_url": "<string>",
"callback_fields": [
{
"key": "<string>",
"label": "<string>",
"type": "text",
"placeholder": "<string>",
"required": true,
"options": [
"<string>"
]
}
]
},
"published_at": 123,
"published_version_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": 123,
"updated_at": 123
}{
"error": {
"code": "VALIDATION_ERROR",
"message": "Request validation failed.",
"details": {
"field": "name",
"reason": "must not be blank"
}
}
}{
"error": {
"code": "UNAUTHORIZED",
"message": "Authentication is required.",
"details": {}
}
}{
"error": {
"code": "FORBIDDEN",
"message": "Permission denied.",
"details": {}
}
}{
"error": {
"code": "RESOURCE_NOT_FOUND",
"message": "Resource not found.",
"details": {
"resource": "agent"
}
}
}{
"error": {
"code": "CONFLICT",
"message": "The requested operation conflicts with current state.",
"details": {
"current_status": "draft"
}
}
}{
"error": {
"code": "RATE_LIMIT_EXCEEDED",
"message": "Too many requests.",
"details": {
"limit": 10,
"window_seconds": 1,
"scope": "user"
}
}
}{
"error": {
"code": "INTERNAL_ERROR",
"message": "Internal server error.",
"details": {}
}
}{
"error": {
"code": "SERVICE_UNAVAILABLE",
"message": "Service temporarily unavailable.",
"details": {}
}
}Authorizations
조직 API 키를 Authorization: Bearer <token> 형식으로 보냅니다.
Body
생성할 위젯입니다.
agent_id와 agent_version으로 구성된 에이전트 매핑 객체입니다.
Show child attributes
Show child attributes
위젯 유형입니다. chat, voice, callback 중 하나를 게시합니다.
chat, voice, callback 발신번호입니다. mode가 callback일 때 게시에 필요합니다.
수신자에게 표시할 번호입니다. null이면 callback_from_number가 표시됩니다.
설치를 허용할 도메인 목록입니다. 각 항목은 소문자 호스트명이거나 단독 *입니다. 빈 목록은 모든 도메인을 거부하고, *는 모두 허용합니다.
대화 시작 한도입니다. null이면 standard(방문자 IP당 분당 5회)를 적용합니다.
Show child attributes
Show child attributes
모양과 메시지 설정입니다. 생략한 키는 설정하지 않습니다.
Show child attributes
Show child attributes
Response
성공 응답
위젯 ID입니다. UUID이며 경로 파라미터 widget_id에 사용합니다.
설치 코드의 data-widget-id입니다. wgt_… 형식이며 서버가 발급하고 읽기 전용입니다.
위젯을 소유한 조직 ID입니다.
agent_id와 agent_version으로 구성된 에이전트 매핑 객체입니다.
Show child attributes
Show child attributes
위젯 상태입니다. draft, published, archived 중 하나이며 생성·수정 요청에서는 바꿀 수 없습니다.
draft, published, archived 위젯 유형입니다. chat, voice, callback 중 하나입니다.
chat, voice, callback 발신번호입니다. 없으면 null입니다.
수신자에게 표시할 번호입니다. null이면 callback_from_number가 표시됩니다.
설치를 허용한 도메인 목록입니다.
대화 시작 한도입니다. null이면 standard(방문자 IP당 분당 5회)를 적용합니다.
Show child attributes
Show child attributes
모양과 메시지 설정입니다. 설정하지 않은 키는 null입니다.
Show child attributes
Show child attributes
마지막 게시 시각입니다. unix milliseconds 형식입니다. 게시를 해제한 뒤에도 유지됩니다. 게시한 적이 없으면 null입니다.
마지막 게시 버전 ID입니다. 게시를 해제한 뒤에도 유지됩니다. 게시한 적이 없으면 null입니다.
리소스 생성 시각입니다. unix milliseconds 형식입니다.
리소스 마지막 수정 시각입니다. unix milliseconds 형식입니다.
Was this page helpful?
curl --request POST \
--url https://client-api.tryvox.co/v3/widgets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agent": {
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"agent_version": "current"
},
"mode": "chat",
"callback_from_number": "<string>",
"callback_presentation_number": "<string>",
"allowed_domains": [
"<string>"
],
"rate_limit": {
"per_minute": 123
},
"branding": {
"title": "<string>",
"accent_color": "<string>",
"orb_colors": {
"primary": "<string>",
"secondary": "<string>"
},
"styles": {
"button_radius": 123,
"input_radius": 123,
"bubble_radius": 123
},
"logo_url": "<string>",
"popup_message": "<string>",
"popup_delay_seconds": 1,
"auto_open": true,
"suggested_replies": [
"<string>"
],
"disclaimer_text": "<string>",
"markdown": true,
"link_allowed_hosts": [
"<string>"
],
"transcript": true,
"fab_text": "<string>",
"white_label": true,
"dynamic_variables": {},
"terms_url": "<string>",
"callback_fields": [
{
"key": "<string>",
"label": "<string>",
"placeholder": "<string>",
"required": true,
"options": [
"<string>"
]
}
]
}
}
'import requests
url = "https://client-api.tryvox.co/v3/widgets"
payload = {
"agent": {
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"agent_version": "current"
},
"mode": "chat",
"callback_from_number": "<string>",
"callback_presentation_number": "<string>",
"allowed_domains": ["<string>"],
"rate_limit": { "per_minute": 123 },
"branding": {
"title": "<string>",
"accent_color": "<string>",
"orb_colors": {
"primary": "<string>",
"secondary": "<string>"
},
"styles": {
"button_radius": 123,
"input_radius": 123,
"bubble_radius": 123
},
"logo_url": "<string>",
"popup_message": "<string>",
"popup_delay_seconds": 1,
"auto_open": True,
"suggested_replies": ["<string>"],
"disclaimer_text": "<string>",
"markdown": True,
"link_allowed_hosts": ["<string>"],
"transcript": True,
"fab_text": "<string>",
"white_label": True,
"dynamic_variables": {},
"terms_url": "<string>",
"callback_fields": [
{
"key": "<string>",
"label": "<string>",
"placeholder": "<string>",
"required": True,
"options": ["<string>"]
}
]
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agent: {agent_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a', agent_version: 'current'},
mode: 'chat',
callback_from_number: '<string>',
callback_presentation_number: '<string>',
allowed_domains: ['<string>'],
rate_limit: {per_minute: 123},
branding: {
title: '<string>',
accent_color: '<string>',
orb_colors: {primary: '<string>', secondary: '<string>'},
styles: {button_radius: 123, input_radius: 123, bubble_radius: 123},
logo_url: '<string>',
popup_message: '<string>',
popup_delay_seconds: 1,
auto_open: true,
suggested_replies: ['<string>'],
disclaimer_text: '<string>',
markdown: true,
link_allowed_hosts: ['<string>'],
transcript: true,
fab_text: '<string>',
white_label: true,
dynamic_variables: {},
terms_url: '<string>',
callback_fields: [
{
key: '<string>',
label: '<string>',
placeholder: '<string>',
required: true,
options: ['<string>']
}
]
}
})
};
fetch('https://client-api.tryvox.co/v3/widgets', 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://client-api.tryvox.co/v3/widgets",
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([
'agent' => [
'agent_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'agent_version' => 'current'
],
'mode' => 'chat',
'callback_from_number' => '<string>',
'callback_presentation_number' => '<string>',
'allowed_domains' => [
'<string>'
],
'rate_limit' => [
'per_minute' => 123
],
'branding' => [
'title' => '<string>',
'accent_color' => '<string>',
'orb_colors' => [
'primary' => '<string>',
'secondary' => '<string>'
],
'styles' => [
'button_radius' => 123,
'input_radius' => 123,
'bubble_radius' => 123
],
'logo_url' => '<string>',
'popup_message' => '<string>',
'popup_delay_seconds' => 1,
'auto_open' => true,
'suggested_replies' => [
'<string>'
],
'disclaimer_text' => '<string>',
'markdown' => true,
'link_allowed_hosts' => [
'<string>'
],
'transcript' => true,
'fab_text' => '<string>',
'white_label' => true,
'dynamic_variables' => [
],
'terms_url' => '<string>',
'callback_fields' => [
[
'key' => '<string>',
'label' => '<string>',
'placeholder' => '<string>',
'required' => true,
'options' => [
'<string>'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://client-api.tryvox.co/v3/widgets"
payload := strings.NewReader("{\n \"agent\": {\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"agent_version\": \"current\"\n },\n \"mode\": \"chat\",\n \"callback_from_number\": \"<string>\",\n \"callback_presentation_number\": \"<string>\",\n \"allowed_domains\": [\n \"<string>\"\n ],\n \"rate_limit\": {\n \"per_minute\": 123\n },\n \"branding\": {\n \"title\": \"<string>\",\n \"accent_color\": \"<string>\",\n \"orb_colors\": {\n \"primary\": \"<string>\",\n \"secondary\": \"<string>\"\n },\n \"styles\": {\n \"button_radius\": 123,\n \"input_radius\": 123,\n \"bubble_radius\": 123\n },\n \"logo_url\": \"<string>\",\n \"popup_message\": \"<string>\",\n \"popup_delay_seconds\": 1,\n \"auto_open\": true,\n \"suggested_replies\": [\n \"<string>\"\n ],\n \"disclaimer_text\": \"<string>\",\n \"markdown\": true,\n \"link_allowed_hosts\": [\n \"<string>\"\n ],\n \"transcript\": true,\n \"fab_text\": \"<string>\",\n \"white_label\": true,\n \"dynamic_variables\": {},\n \"terms_url\": \"<string>\",\n \"callback_fields\": [\n {\n \"key\": \"<string>\",\n \"label\": \"<string>\",\n \"placeholder\": \"<string>\",\n \"required\": true,\n \"options\": [\n \"<string>\"\n ]\n }\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://client-api.tryvox.co/v3/widgets")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agent\": {\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"agent_version\": \"current\"\n },\n \"mode\": \"chat\",\n \"callback_from_number\": \"<string>\",\n \"callback_presentation_number\": \"<string>\",\n \"allowed_domains\": [\n \"<string>\"\n ],\n \"rate_limit\": {\n \"per_minute\": 123\n },\n \"branding\": {\n \"title\": \"<string>\",\n \"accent_color\": \"<string>\",\n \"orb_colors\": {\n \"primary\": \"<string>\",\n \"secondary\": \"<string>\"\n },\n \"styles\": {\n \"button_radius\": 123,\n \"input_radius\": 123,\n \"bubble_radius\": 123\n },\n \"logo_url\": \"<string>\",\n \"popup_message\": \"<string>\",\n \"popup_delay_seconds\": 1,\n \"auto_open\": true,\n \"suggested_replies\": [\n \"<string>\"\n ],\n \"disclaimer_text\": \"<string>\",\n \"markdown\": true,\n \"link_allowed_hosts\": [\n \"<string>\"\n ],\n \"transcript\": true,\n \"fab_text\": \"<string>\",\n \"white_label\": true,\n \"dynamic_variables\": {},\n \"terms_url\": \"<string>\",\n \"callback_fields\": [\n {\n \"key\": \"<string>\",\n \"label\": \"<string>\",\n \"placeholder\": \"<string>\",\n \"required\": true,\n \"options\": [\n \"<string>\"\n ]\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://client-api.tryvox.co/v3/widgets")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agent\": {\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"agent_version\": \"current\"\n },\n \"mode\": \"chat\",\n \"callback_from_number\": \"<string>\",\n \"callback_presentation_number\": \"<string>\",\n \"allowed_domains\": [\n \"<string>\"\n ],\n \"rate_limit\": {\n \"per_minute\": 123\n },\n \"branding\": {\n \"title\": \"<string>\",\n \"accent_color\": \"<string>\",\n \"orb_colors\": {\n \"primary\": \"<string>\",\n \"secondary\": \"<string>\"\n },\n \"styles\": {\n \"button_radius\": 123,\n \"input_radius\": 123,\n \"bubble_radius\": 123\n },\n \"logo_url\": \"<string>\",\n \"popup_message\": \"<string>\",\n \"popup_delay_seconds\": 1,\n \"auto_open\": true,\n \"suggested_replies\": [\n \"<string>\"\n ],\n \"disclaimer_text\": \"<string>\",\n \"markdown\": true,\n \"link_allowed_hosts\": [\n \"<string>\"\n ],\n \"transcript\": true,\n \"fab_text\": \"<string>\",\n \"white_label\": true,\n \"dynamic_variables\": {},\n \"terms_url\": \"<string>\",\n \"callback_fields\": [\n {\n \"key\": \"<string>\",\n \"label\": \"<string>\",\n \"placeholder\": \"<string>\",\n \"required\": true,\n \"options\": [\n \"<string>\"\n ]\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"public_id": "<string>",
"organization_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"agent": {
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"agent_version": "current"
},
"status": "draft",
"mode": "chat",
"callback_from_number": "<string>",
"callback_presentation_number": "<string>",
"allowed_domains": [
"<string>"
],
"rate_limit": {
"preset": "standard",
"per_minute": 123
},
"branding": {
"title": "<string>",
"accent_color": "<string>",
"orb_colors": {
"primary": "<string>",
"secondary": "<string>"
},
"styles": {
"button_radius": 123,
"input_radius": 123,
"bubble_radius": 123
},
"theme": "light",
"logo_url": "<string>",
"popup_message": "<string>",
"popup_delay_seconds": 123,
"auto_open": true,
"suggested_replies": [
"<string>"
],
"disclaimer_text": "<string>",
"markdown": true,
"link_allowed_hosts": [
"<string>"
],
"transcript": true,
"fab_text": "<string>",
"placement": "bottom-right",
"panel_size": "compact",
"white_label": true,
"dynamic_variables": {},
"terms_url": "<string>",
"callback_fields": [
{
"key": "<string>",
"label": "<string>",
"type": "text",
"placeholder": "<string>",
"required": true,
"options": [
"<string>"
]
}
]
},
"published_at": 123,
"published_version_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": 123,
"updated_at": 123
}{
"error": {
"code": "VALIDATION_ERROR",
"message": "Request validation failed.",
"details": {
"field": "name",
"reason": "must not be blank"
}
}
}{
"error": {
"code": "UNAUTHORIZED",
"message": "Authentication is required.",
"details": {}
}
}{
"error": {
"code": "FORBIDDEN",
"message": "Permission denied.",
"details": {}
}
}{
"error": {
"code": "RESOURCE_NOT_FOUND",
"message": "Resource not found.",
"details": {
"resource": "agent"
}
}
}{
"error": {
"code": "CONFLICT",
"message": "The requested operation conflicts with current state.",
"details": {
"current_status": "draft"
}
}
}{
"error": {
"code": "RATE_LIMIT_EXCEEDED",
"message": "Too many requests.",
"details": {
"limit": 10,
"window_seconds": 1,
"scope": "user"
}
}
}{
"error": {
"code": "INTERNAL_ERROR",
"message": "Internal server error.",
"details": {}
}
}{
"error": {
"code": "SERVICE_UNAVAILABLE",
"message": "Service temporarily unavailable.",
"details": {}
}
}