Update a chatbot
curl --request PATCH \
--url https://api.chatling.ai/v3/chatbots/{chatbot} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Orders",
"timezone": "Europe/Berlin"
}
'import requests
url = "https://api.chatling.ai/v3/chatbots/{chatbot}"
payload = {
"name": "Orders",
"timezone": "Europe/Berlin"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'Orders', timezone: 'Europe/Berlin'})
};
fetch('https://api.chatling.ai/v3/chatbots/{chatbot}', 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.chatling.ai/v3/chatbots/{chatbot}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Orders',
'timezone' => 'Europe/Berlin'
]),
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://api.chatling.ai/v3/chatbots/{chatbot}"
payload := strings.NewReader("{\n \"name\": \"Orders\",\n \"timezone\": \"Europe/Berlin\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.chatling.ai/v3/chatbots/{chatbot}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Orders\",\n \"timezone\": \"Europe/Berlin\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.chatling.ai/v3/chatbots/{chatbot}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Orders\",\n \"timezone\": \"Europe/Berlin\"\n}"
response = http.request(request)
puts response.read_body{
"object": "chatbot",
"id": "3132353852",
"name": "Order bot",
"platform": "web",
"status": "active",
"published": true,
"timezone": "America/Toronto",
"created_at": "2023-11-07T05:31:56Z"
}{
"error": {
"type": "authentication_error",
"code": "validation_failed",
"message": "<string>",
"param": "<string>",
"request_id": "<string>",
"errors": [
{
"param": "<string>",
"message": "<string>"
}
]
}
}{
"error": {
"type": "authentication_error",
"code": "invalid_api_key",
"message": "The API key is invalid or has been revoked.",
"param": null,
"request_id": "req_8Fq2kLm9TzX4vB7nC1dR5sYw"
}
}{
"error": {
"type": "authentication_error",
"code": "validation_failed",
"message": "<string>",
"param": "<string>",
"request_id": "<string>",
"errors": [
{
"param": "<string>",
"message": "<string>"
}
]
}
}{
"error": {
"type": "not_found_error",
"code": "resource_not_found",
"message": "This ID is an AI agent's. Use /v3/agents/3132353852 instead.",
"param": null,
"request_id": "req_8Fq2kLm9TzX4vB7nC1dR5sYw"
}
}{
"error": {
"type": "invalid_request_error",
"code": "validation_failed",
"message": "The name field is required.",
"param": "name",
"request_id": "req_8Fq2kLm9TzX4vB7nC1dR5sYw",
"errors": [
{
"param": "name",
"message": "The name field is required."
}
]
}
}{
"error": {
"type": "authentication_error",
"code": "validation_failed",
"message": "<string>",
"param": "<string>",
"request_id": "<string>",
"errors": [
{
"param": "<string>",
"message": "<string>"
}
]
}
}Chatbots
Update a chatbot
Available for chatbots only.
For AI agents, use Update an AI agent.
Updates the specified chatbot by setting the values of the parameters passed. Any parameters not provided are left unchanged. Flows can only be changed in the dashboard via the Builder page.
PATCH
/
chatbots
/
{chatbot}
Update a chatbot
curl --request PATCH \
--url https://api.chatling.ai/v3/chatbots/{chatbot} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Orders",
"timezone": "Europe/Berlin"
}
'import requests
url = "https://api.chatling.ai/v3/chatbots/{chatbot}"
payload = {
"name": "Orders",
"timezone": "Europe/Berlin"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'Orders', timezone: 'Europe/Berlin'})
};
fetch('https://api.chatling.ai/v3/chatbots/{chatbot}', 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.chatling.ai/v3/chatbots/{chatbot}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Orders',
'timezone' => 'Europe/Berlin'
]),
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://api.chatling.ai/v3/chatbots/{chatbot}"
payload := strings.NewReader("{\n \"name\": \"Orders\",\n \"timezone\": \"Europe/Berlin\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.chatling.ai/v3/chatbots/{chatbot}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Orders\",\n \"timezone\": \"Europe/Berlin\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.chatling.ai/v3/chatbots/{chatbot}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Orders\",\n \"timezone\": \"Europe/Berlin\"\n}"
response = http.request(request)
puts response.read_body{
"object": "chatbot",
"id": "3132353852",
"name": "Order bot",
"platform": "web",
"status": "active",
"published": true,
"timezone": "America/Toronto",
"created_at": "2023-11-07T05:31:56Z"
}{
"error": {
"type": "authentication_error",
"code": "validation_failed",
"message": "<string>",
"param": "<string>",
"request_id": "<string>",
"errors": [
{
"param": "<string>",
"message": "<string>"
}
]
}
}{
"error": {
"type": "authentication_error",
"code": "invalid_api_key",
"message": "The API key is invalid or has been revoked.",
"param": null,
"request_id": "req_8Fq2kLm9TzX4vB7nC1dR5sYw"
}
}{
"error": {
"type": "authentication_error",
"code": "validation_failed",
"message": "<string>",
"param": "<string>",
"request_id": "<string>",
"errors": [
{
"param": "<string>",
"message": "<string>"
}
]
}
}{
"error": {
"type": "not_found_error",
"code": "resource_not_found",
"message": "This ID is an AI agent's. Use /v3/agents/3132353852 instead.",
"param": null,
"request_id": "req_8Fq2kLm9TzX4vB7nC1dR5sYw"
}
}{
"error": {
"type": "invalid_request_error",
"code": "validation_failed",
"message": "The name field is required.",
"param": "name",
"request_id": "req_8Fq2kLm9TzX4vB7nC1dR5sYw",
"errors": [
{
"param": "name",
"message": "The name field is required."
}
]
}
}{
"error": {
"type": "authentication_error",
"code": "validation_failed",
"message": "<string>",
"param": "<string>",
"request_id": "<string>",
"errors": [
{
"param": "<string>",
"message": "<string>"
}
]
}
}Body
application/json
Unknown parameters return 422. A chatbot's AI settings and business name are set in its flow's AI blocks in the dashboard, so ai and business_name aren't accepted.
Response
The updated chatbot.
A flow-builder chatbot. You build and publish its flow, including the AI settings of its AI blocks, in the dashboard.