Update agent styles
curl --request PUT \
--url https://www.chatbase.co/api/v2/agents/{agentId}/styles \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"styles": {
"chat": {
"theme": "light",
"headerColor": "#1A2B3C",
"userMessageColor": "#1A2B3C",
"buttonColor": "#1A2B3C",
"displayName": "<string>",
"autoOpenChatWindowAfter": 5,
"mobile": {
"initialMessages": {
"enabled": true,
"value": [
"<string>"
]
},
"autoOpenChatWindowAfter": {
"enabled": true,
"value": 123
},
"showAutoOpen": true
},
"alignChatButton": "right",
"messagePlaceholder": "<string>",
"footer": "<string>",
"showFeedback": true,
"showCopyButton": true,
"dismissableNotice": "<string>",
"showDictation": true,
"showAttachments": true,
"showVoiceMode": true
},
"centerStage": {
"enabled": true,
"displayName": "<string>",
"welcomeMessage": "<string>",
"messagePlaceholder": "<string>",
"dismissableNotice": "<string>",
"footer": "<string>",
"suggestedMessages": [
{
"text": "<string>",
"type": "single",
"order": 123,
"icon": "<string>"
}
],
"showChatBubble": true,
"showAttachments": true,
"showDictation": true,
"showVoiceMode": true,
"showCopyButton": true,
"showFeedback": true,
"showDataSource": true,
"theme": "light",
"buttonColor": "#1A2B3C",
"headerColor": "#1A2B3C",
"userMessageColor": "#1A2B3C",
"width": "medium",
"closeOnOutsideClick": true
}
}
}
'import requests
url = "https://www.chatbase.co/api/v2/agents/{agentId}/styles"
payload = { "styles": {
"chat": {
"theme": "light",
"headerColor": "#1A2B3C",
"userMessageColor": "#1A2B3C",
"buttonColor": "#1A2B3C",
"displayName": "<string>",
"autoOpenChatWindowAfter": 5,
"mobile": {
"initialMessages": {
"enabled": True,
"value": ["<string>"]
},
"autoOpenChatWindowAfter": {
"enabled": True,
"value": 123
},
"showAutoOpen": True
},
"alignChatButton": "right",
"messagePlaceholder": "<string>",
"footer": "<string>",
"showFeedback": True,
"showCopyButton": True,
"dismissableNotice": "<string>",
"showDictation": True,
"showAttachments": True,
"showVoiceMode": True
},
"centerStage": {
"enabled": True,
"displayName": "<string>",
"welcomeMessage": "<string>",
"messagePlaceholder": "<string>",
"dismissableNotice": "<string>",
"footer": "<string>",
"suggestedMessages": [
{
"text": "<string>",
"type": "single",
"order": 123,
"icon": "<string>"
}
],
"showChatBubble": True,
"showAttachments": True,
"showDictation": True,
"showVoiceMode": True,
"showCopyButton": True,
"showFeedback": True,
"showDataSource": True,
"theme": "light",
"buttonColor": "#1A2B3C",
"headerColor": "#1A2B3C",
"userMessageColor": "#1A2B3C",
"width": "medium",
"closeOnOutsideClick": True
}
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
styles: {
chat: {
theme: 'light',
headerColor: '#1A2B3C',
userMessageColor: '#1A2B3C',
buttonColor: '#1A2B3C',
displayName: '<string>',
autoOpenChatWindowAfter: 5,
mobile: {
initialMessages: {enabled: true, value: ['<string>']},
autoOpenChatWindowAfter: {enabled: true, value: 123},
showAutoOpen: true
},
alignChatButton: 'right',
messagePlaceholder: '<string>',
footer: '<string>',
showFeedback: true,
showCopyButton: true,
dismissableNotice: '<string>',
showDictation: true,
showAttachments: true,
showVoiceMode: true
},
centerStage: {
enabled: true,
displayName: '<string>',
welcomeMessage: '<string>',
messagePlaceholder: '<string>',
dismissableNotice: '<string>',
footer: '<string>',
suggestedMessages: [{text: '<string>', type: 'single', order: 123, icon: '<string>'}],
showChatBubble: true,
showAttachments: true,
showDictation: true,
showVoiceMode: true,
showCopyButton: true,
showFeedback: true,
showDataSource: true,
theme: 'light',
buttonColor: '#1A2B3C',
headerColor: '#1A2B3C',
userMessageColor: '#1A2B3C',
width: 'medium',
closeOnOutsideClick: true
}
}
})
};
fetch('https://www.chatbase.co/api/v2/agents/{agentId}/styles', 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://www.chatbase.co/api/v2/agents/{agentId}/styles",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'styles' => [
'chat' => [
'theme' => 'light',
'headerColor' => '#1A2B3C',
'userMessageColor' => '#1A2B3C',
'buttonColor' => '#1A2B3C',
'displayName' => '<string>',
'autoOpenChatWindowAfter' => 5,
'mobile' => [
'initialMessages' => [
'enabled' => true,
'value' => [
'<string>'
]
],
'autoOpenChatWindowAfter' => [
'enabled' => true,
'value' => 123
],
'showAutoOpen' => true
],
'alignChatButton' => 'right',
'messagePlaceholder' => '<string>',
'footer' => '<string>',
'showFeedback' => true,
'showCopyButton' => true,
'dismissableNotice' => '<string>',
'showDictation' => true,
'showAttachments' => true,
'showVoiceMode' => true
],
'centerStage' => [
'enabled' => true,
'displayName' => '<string>',
'welcomeMessage' => '<string>',
'messagePlaceholder' => '<string>',
'dismissableNotice' => '<string>',
'footer' => '<string>',
'suggestedMessages' => [
[
'text' => '<string>',
'type' => 'single',
'order' => 123,
'icon' => '<string>'
]
],
'showChatBubble' => true,
'showAttachments' => true,
'showDictation' => true,
'showVoiceMode' => true,
'showCopyButton' => true,
'showFeedback' => true,
'showDataSource' => true,
'theme' => 'light',
'buttonColor' => '#1A2B3C',
'headerColor' => '#1A2B3C',
'userMessageColor' => '#1A2B3C',
'width' => 'medium',
'closeOnOutsideClick' => true
]
]
]),
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://www.chatbase.co/api/v2/agents/{agentId}/styles"
payload := strings.NewReader("{\n \"styles\": {\n \"chat\": {\n \"theme\": \"light\",\n \"headerColor\": \"#1A2B3C\",\n \"userMessageColor\": \"#1A2B3C\",\n \"buttonColor\": \"#1A2B3C\",\n \"displayName\": \"<string>\",\n \"autoOpenChatWindowAfter\": 5,\n \"mobile\": {\n \"initialMessages\": {\n \"enabled\": true,\n \"value\": [\n \"<string>\"\n ]\n },\n \"autoOpenChatWindowAfter\": {\n \"enabled\": true,\n \"value\": 123\n },\n \"showAutoOpen\": true\n },\n \"alignChatButton\": \"right\",\n \"messagePlaceholder\": \"<string>\",\n \"footer\": \"<string>\",\n \"showFeedback\": true,\n \"showCopyButton\": true,\n \"dismissableNotice\": \"<string>\",\n \"showDictation\": true,\n \"showAttachments\": true,\n \"showVoiceMode\": true\n },\n \"centerStage\": {\n \"enabled\": true,\n \"displayName\": \"<string>\",\n \"welcomeMessage\": \"<string>\",\n \"messagePlaceholder\": \"<string>\",\n \"dismissableNotice\": \"<string>\",\n \"footer\": \"<string>\",\n \"suggestedMessages\": [\n {\n \"text\": \"<string>\",\n \"type\": \"single\",\n \"order\": 123,\n \"icon\": \"<string>\"\n }\n ],\n \"showChatBubble\": true,\n \"showAttachments\": true,\n \"showDictation\": true,\n \"showVoiceMode\": true,\n \"showCopyButton\": true,\n \"showFeedback\": true,\n \"showDataSource\": true,\n \"theme\": \"light\",\n \"buttonColor\": \"#1A2B3C\",\n \"headerColor\": \"#1A2B3C\",\n \"userMessageColor\": \"#1A2B3C\",\n \"width\": \"medium\",\n \"closeOnOutsideClick\": true\n }\n }\n}")
req, _ := http.NewRequest("PUT", 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.put("https://www.chatbase.co/api/v2/agents/{agentId}/styles")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"styles\": {\n \"chat\": {\n \"theme\": \"light\",\n \"headerColor\": \"#1A2B3C\",\n \"userMessageColor\": \"#1A2B3C\",\n \"buttonColor\": \"#1A2B3C\",\n \"displayName\": \"<string>\",\n \"autoOpenChatWindowAfter\": 5,\n \"mobile\": {\n \"initialMessages\": {\n \"enabled\": true,\n \"value\": [\n \"<string>\"\n ]\n },\n \"autoOpenChatWindowAfter\": {\n \"enabled\": true,\n \"value\": 123\n },\n \"showAutoOpen\": true\n },\n \"alignChatButton\": \"right\",\n \"messagePlaceholder\": \"<string>\",\n \"footer\": \"<string>\",\n \"showFeedback\": true,\n \"showCopyButton\": true,\n \"dismissableNotice\": \"<string>\",\n \"showDictation\": true,\n \"showAttachments\": true,\n \"showVoiceMode\": true\n },\n \"centerStage\": {\n \"enabled\": true,\n \"displayName\": \"<string>\",\n \"welcomeMessage\": \"<string>\",\n \"messagePlaceholder\": \"<string>\",\n \"dismissableNotice\": \"<string>\",\n \"footer\": \"<string>\",\n \"suggestedMessages\": [\n {\n \"text\": \"<string>\",\n \"type\": \"single\",\n \"order\": 123,\n \"icon\": \"<string>\"\n }\n ],\n \"showChatBubble\": true,\n \"showAttachments\": true,\n \"showDictation\": true,\n \"showVoiceMode\": true,\n \"showCopyButton\": true,\n \"showFeedback\": true,\n \"showDataSource\": true,\n \"theme\": \"light\",\n \"buttonColor\": \"#1A2B3C\",\n \"headerColor\": \"#1A2B3C\",\n \"userMessageColor\": \"#1A2B3C\",\n \"width\": \"medium\",\n \"closeOnOutsideClick\": true\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.chatbase.co/api/v2/agents/{agentId}/styles")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"styles\": {\n \"chat\": {\n \"theme\": \"light\",\n \"headerColor\": \"#1A2B3C\",\n \"userMessageColor\": \"#1A2B3C\",\n \"buttonColor\": \"#1A2B3C\",\n \"displayName\": \"<string>\",\n \"autoOpenChatWindowAfter\": 5,\n \"mobile\": {\n \"initialMessages\": {\n \"enabled\": true,\n \"value\": [\n \"<string>\"\n ]\n },\n \"autoOpenChatWindowAfter\": {\n \"enabled\": true,\n \"value\": 123\n },\n \"showAutoOpen\": true\n },\n \"alignChatButton\": \"right\",\n \"messagePlaceholder\": \"<string>\",\n \"footer\": \"<string>\",\n \"showFeedback\": true,\n \"showCopyButton\": true,\n \"dismissableNotice\": \"<string>\",\n \"showDictation\": true,\n \"showAttachments\": true,\n \"showVoiceMode\": true\n },\n \"centerStage\": {\n \"enabled\": true,\n \"displayName\": \"<string>\",\n \"welcomeMessage\": \"<string>\",\n \"messagePlaceholder\": \"<string>\",\n \"dismissableNotice\": \"<string>\",\n \"footer\": \"<string>\",\n \"suggestedMessages\": [\n {\n \"text\": \"<string>\",\n \"type\": \"single\",\n \"order\": 123,\n \"icon\": \"<string>\"\n }\n ],\n \"showChatBubble\": true,\n \"showAttachments\": true,\n \"showDictation\": true,\n \"showVoiceMode\": true,\n \"showCopyButton\": true,\n \"showFeedback\": true,\n \"showDataSource\": true,\n \"theme\": \"light\",\n \"buttonColor\": \"#1A2B3C\",\n \"headerColor\": \"#1A2B3C\",\n \"userMessageColor\": \"#1A2B3C\",\n \"width\": \"medium\",\n \"closeOnOutsideClick\": true\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true
}{
"error": {
"code": "VALIDATION_INVALID_BODY",
"message": "Invalid request"
}
}{
"error": {
"code": "AUTH_MISSING_API_KEY",
"message": "Authentication required"
}
}{
"error": {
"code": "SUBSCRIPTION_API_RESTRICTED_PLAN",
"message": "A Standard plan or higher is required to access the API"
}
}{
"error": {
"code": "AGENT_NOT_FOUND",
"message": "Agent not found"
}
}{
"error": {
"code": "RATE_LIMIT_TOO_MANY_REQUESTS",
"message": "Too many requests, please try again later"
}
}{
"error": {
"code": "INTERNAL_SERVER_ERROR",
"message": "Something went wrong, please try again"
}
}{
"error": {
"code": "SERVICE_UNDER_MAINTENANCE",
"message": "The API is temporarily unavailable for scheduled maintenance, please try again later"
}
}Agents
Update agent styles
Updates the visual styles for an agent.
PUT
/
agents
/
{agentId}
/
styles
Update agent styles
curl --request PUT \
--url https://www.chatbase.co/api/v2/agents/{agentId}/styles \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"styles": {
"chat": {
"theme": "light",
"headerColor": "#1A2B3C",
"userMessageColor": "#1A2B3C",
"buttonColor": "#1A2B3C",
"displayName": "<string>",
"autoOpenChatWindowAfter": 5,
"mobile": {
"initialMessages": {
"enabled": true,
"value": [
"<string>"
]
},
"autoOpenChatWindowAfter": {
"enabled": true,
"value": 123
},
"showAutoOpen": true
},
"alignChatButton": "right",
"messagePlaceholder": "<string>",
"footer": "<string>",
"showFeedback": true,
"showCopyButton": true,
"dismissableNotice": "<string>",
"showDictation": true,
"showAttachments": true,
"showVoiceMode": true
},
"centerStage": {
"enabled": true,
"displayName": "<string>",
"welcomeMessage": "<string>",
"messagePlaceholder": "<string>",
"dismissableNotice": "<string>",
"footer": "<string>",
"suggestedMessages": [
{
"text": "<string>",
"type": "single",
"order": 123,
"icon": "<string>"
}
],
"showChatBubble": true,
"showAttachments": true,
"showDictation": true,
"showVoiceMode": true,
"showCopyButton": true,
"showFeedback": true,
"showDataSource": true,
"theme": "light",
"buttonColor": "#1A2B3C",
"headerColor": "#1A2B3C",
"userMessageColor": "#1A2B3C",
"width": "medium",
"closeOnOutsideClick": true
}
}
}
'import requests
url = "https://www.chatbase.co/api/v2/agents/{agentId}/styles"
payload = { "styles": {
"chat": {
"theme": "light",
"headerColor": "#1A2B3C",
"userMessageColor": "#1A2B3C",
"buttonColor": "#1A2B3C",
"displayName": "<string>",
"autoOpenChatWindowAfter": 5,
"mobile": {
"initialMessages": {
"enabled": True,
"value": ["<string>"]
},
"autoOpenChatWindowAfter": {
"enabled": True,
"value": 123
},
"showAutoOpen": True
},
"alignChatButton": "right",
"messagePlaceholder": "<string>",
"footer": "<string>",
"showFeedback": True,
"showCopyButton": True,
"dismissableNotice": "<string>",
"showDictation": True,
"showAttachments": True,
"showVoiceMode": True
},
"centerStage": {
"enabled": True,
"displayName": "<string>",
"welcomeMessage": "<string>",
"messagePlaceholder": "<string>",
"dismissableNotice": "<string>",
"footer": "<string>",
"suggestedMessages": [
{
"text": "<string>",
"type": "single",
"order": 123,
"icon": "<string>"
}
],
"showChatBubble": True,
"showAttachments": True,
"showDictation": True,
"showVoiceMode": True,
"showCopyButton": True,
"showFeedback": True,
"showDataSource": True,
"theme": "light",
"buttonColor": "#1A2B3C",
"headerColor": "#1A2B3C",
"userMessageColor": "#1A2B3C",
"width": "medium",
"closeOnOutsideClick": True
}
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
styles: {
chat: {
theme: 'light',
headerColor: '#1A2B3C',
userMessageColor: '#1A2B3C',
buttonColor: '#1A2B3C',
displayName: '<string>',
autoOpenChatWindowAfter: 5,
mobile: {
initialMessages: {enabled: true, value: ['<string>']},
autoOpenChatWindowAfter: {enabled: true, value: 123},
showAutoOpen: true
},
alignChatButton: 'right',
messagePlaceholder: '<string>',
footer: '<string>',
showFeedback: true,
showCopyButton: true,
dismissableNotice: '<string>',
showDictation: true,
showAttachments: true,
showVoiceMode: true
},
centerStage: {
enabled: true,
displayName: '<string>',
welcomeMessage: '<string>',
messagePlaceholder: '<string>',
dismissableNotice: '<string>',
footer: '<string>',
suggestedMessages: [{text: '<string>', type: 'single', order: 123, icon: '<string>'}],
showChatBubble: true,
showAttachments: true,
showDictation: true,
showVoiceMode: true,
showCopyButton: true,
showFeedback: true,
showDataSource: true,
theme: 'light',
buttonColor: '#1A2B3C',
headerColor: '#1A2B3C',
userMessageColor: '#1A2B3C',
width: 'medium',
closeOnOutsideClick: true
}
}
})
};
fetch('https://www.chatbase.co/api/v2/agents/{agentId}/styles', 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://www.chatbase.co/api/v2/agents/{agentId}/styles",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'styles' => [
'chat' => [
'theme' => 'light',
'headerColor' => '#1A2B3C',
'userMessageColor' => '#1A2B3C',
'buttonColor' => '#1A2B3C',
'displayName' => '<string>',
'autoOpenChatWindowAfter' => 5,
'mobile' => [
'initialMessages' => [
'enabled' => true,
'value' => [
'<string>'
]
],
'autoOpenChatWindowAfter' => [
'enabled' => true,
'value' => 123
],
'showAutoOpen' => true
],
'alignChatButton' => 'right',
'messagePlaceholder' => '<string>',
'footer' => '<string>',
'showFeedback' => true,
'showCopyButton' => true,
'dismissableNotice' => '<string>',
'showDictation' => true,
'showAttachments' => true,
'showVoiceMode' => true
],
'centerStage' => [
'enabled' => true,
'displayName' => '<string>',
'welcomeMessage' => '<string>',
'messagePlaceholder' => '<string>',
'dismissableNotice' => '<string>',
'footer' => '<string>',
'suggestedMessages' => [
[
'text' => '<string>',
'type' => 'single',
'order' => 123,
'icon' => '<string>'
]
],
'showChatBubble' => true,
'showAttachments' => true,
'showDictation' => true,
'showVoiceMode' => true,
'showCopyButton' => true,
'showFeedback' => true,
'showDataSource' => true,
'theme' => 'light',
'buttonColor' => '#1A2B3C',
'headerColor' => '#1A2B3C',
'userMessageColor' => '#1A2B3C',
'width' => 'medium',
'closeOnOutsideClick' => true
]
]
]),
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://www.chatbase.co/api/v2/agents/{agentId}/styles"
payload := strings.NewReader("{\n \"styles\": {\n \"chat\": {\n \"theme\": \"light\",\n \"headerColor\": \"#1A2B3C\",\n \"userMessageColor\": \"#1A2B3C\",\n \"buttonColor\": \"#1A2B3C\",\n \"displayName\": \"<string>\",\n \"autoOpenChatWindowAfter\": 5,\n \"mobile\": {\n \"initialMessages\": {\n \"enabled\": true,\n \"value\": [\n \"<string>\"\n ]\n },\n \"autoOpenChatWindowAfter\": {\n \"enabled\": true,\n \"value\": 123\n },\n \"showAutoOpen\": true\n },\n \"alignChatButton\": \"right\",\n \"messagePlaceholder\": \"<string>\",\n \"footer\": \"<string>\",\n \"showFeedback\": true,\n \"showCopyButton\": true,\n \"dismissableNotice\": \"<string>\",\n \"showDictation\": true,\n \"showAttachments\": true,\n \"showVoiceMode\": true\n },\n \"centerStage\": {\n \"enabled\": true,\n \"displayName\": \"<string>\",\n \"welcomeMessage\": \"<string>\",\n \"messagePlaceholder\": \"<string>\",\n \"dismissableNotice\": \"<string>\",\n \"footer\": \"<string>\",\n \"suggestedMessages\": [\n {\n \"text\": \"<string>\",\n \"type\": \"single\",\n \"order\": 123,\n \"icon\": \"<string>\"\n }\n ],\n \"showChatBubble\": true,\n \"showAttachments\": true,\n \"showDictation\": true,\n \"showVoiceMode\": true,\n \"showCopyButton\": true,\n \"showFeedback\": true,\n \"showDataSource\": true,\n \"theme\": \"light\",\n \"buttonColor\": \"#1A2B3C\",\n \"headerColor\": \"#1A2B3C\",\n \"userMessageColor\": \"#1A2B3C\",\n \"width\": \"medium\",\n \"closeOnOutsideClick\": true\n }\n }\n}")
req, _ := http.NewRequest("PUT", 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.put("https://www.chatbase.co/api/v2/agents/{agentId}/styles")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"styles\": {\n \"chat\": {\n \"theme\": \"light\",\n \"headerColor\": \"#1A2B3C\",\n \"userMessageColor\": \"#1A2B3C\",\n \"buttonColor\": \"#1A2B3C\",\n \"displayName\": \"<string>\",\n \"autoOpenChatWindowAfter\": 5,\n \"mobile\": {\n \"initialMessages\": {\n \"enabled\": true,\n \"value\": [\n \"<string>\"\n ]\n },\n \"autoOpenChatWindowAfter\": {\n \"enabled\": true,\n \"value\": 123\n },\n \"showAutoOpen\": true\n },\n \"alignChatButton\": \"right\",\n \"messagePlaceholder\": \"<string>\",\n \"footer\": \"<string>\",\n \"showFeedback\": true,\n \"showCopyButton\": true,\n \"dismissableNotice\": \"<string>\",\n \"showDictation\": true,\n \"showAttachments\": true,\n \"showVoiceMode\": true\n },\n \"centerStage\": {\n \"enabled\": true,\n \"displayName\": \"<string>\",\n \"welcomeMessage\": \"<string>\",\n \"messagePlaceholder\": \"<string>\",\n \"dismissableNotice\": \"<string>\",\n \"footer\": \"<string>\",\n \"suggestedMessages\": [\n {\n \"text\": \"<string>\",\n \"type\": \"single\",\n \"order\": 123,\n \"icon\": \"<string>\"\n }\n ],\n \"showChatBubble\": true,\n \"showAttachments\": true,\n \"showDictation\": true,\n \"showVoiceMode\": true,\n \"showCopyButton\": true,\n \"showFeedback\": true,\n \"showDataSource\": true,\n \"theme\": \"light\",\n \"buttonColor\": \"#1A2B3C\",\n \"headerColor\": \"#1A2B3C\",\n \"userMessageColor\": \"#1A2B3C\",\n \"width\": \"medium\",\n \"closeOnOutsideClick\": true\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.chatbase.co/api/v2/agents/{agentId}/styles")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"styles\": {\n \"chat\": {\n \"theme\": \"light\",\n \"headerColor\": \"#1A2B3C\",\n \"userMessageColor\": \"#1A2B3C\",\n \"buttonColor\": \"#1A2B3C\",\n \"displayName\": \"<string>\",\n \"autoOpenChatWindowAfter\": 5,\n \"mobile\": {\n \"initialMessages\": {\n \"enabled\": true,\n \"value\": [\n \"<string>\"\n ]\n },\n \"autoOpenChatWindowAfter\": {\n \"enabled\": true,\n \"value\": 123\n },\n \"showAutoOpen\": true\n },\n \"alignChatButton\": \"right\",\n \"messagePlaceholder\": \"<string>\",\n \"footer\": \"<string>\",\n \"showFeedback\": true,\n \"showCopyButton\": true,\n \"dismissableNotice\": \"<string>\",\n \"showDictation\": true,\n \"showAttachments\": true,\n \"showVoiceMode\": true\n },\n \"centerStage\": {\n \"enabled\": true,\n \"displayName\": \"<string>\",\n \"welcomeMessage\": \"<string>\",\n \"messagePlaceholder\": \"<string>\",\n \"dismissableNotice\": \"<string>\",\n \"footer\": \"<string>\",\n \"suggestedMessages\": [\n {\n \"text\": \"<string>\",\n \"type\": \"single\",\n \"order\": 123,\n \"icon\": \"<string>\"\n }\n ],\n \"showChatBubble\": true,\n \"showAttachments\": true,\n \"showDictation\": true,\n \"showVoiceMode\": true,\n \"showCopyButton\": true,\n \"showFeedback\": true,\n \"showDataSource\": true,\n \"theme\": \"light\",\n \"buttonColor\": \"#1A2B3C\",\n \"headerColor\": \"#1A2B3C\",\n \"userMessageColor\": \"#1A2B3C\",\n \"width\": \"medium\",\n \"closeOnOutsideClick\": true\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true
}{
"error": {
"code": "VALIDATION_INVALID_BODY",
"message": "Invalid request"
}
}{
"error": {
"code": "AUTH_MISSING_API_KEY",
"message": "Authentication required"
}
}{
"error": {
"code": "SUBSCRIPTION_API_RESTRICTED_PLAN",
"message": "A Standard plan or higher is required to access the API"
}
}{
"error": {
"code": "AGENT_NOT_FOUND",
"message": "Agent not found"
}
}{
"error": {
"code": "RATE_LIMIT_TOO_MANY_REQUESTS",
"message": "Too many requests, please try again later"
}
}{
"error": {
"code": "INTERNAL_SERVER_ERROR",
"message": "Something went wrong, please try again"
}
}{
"error": {
"code": "SERVICE_UNDER_MAINTENANCE",
"message": "The API is temporarily unavailable for scheduled maintenance, please try again later"
}
}Authorizations
API key from your account settings
Path Parameters
The agent ID
Minimum string length:
1Example:
"5QHA6VB-DIAbBhxwqxfdi"
Body
application/json
Show child attributes
Show child attributes
Response
Styles updated
Available options:
true ⌘I
