Chat with Knowledge Base AI
curl --request POST \
--url https://api.chatling.ai/v2/chatbots/{chatbotId}/ai/kb/chat \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"message": "<string>",
"ai_model_id": 123,
"conversation_id": "<string>",
"contact_id": "<string>",
"language_id": 123,
"temperature": 123,
"instructions": [
{}
]
}
'import requests
url = "https://api.chatling.ai/v2/chatbots/{chatbotId}/ai/kb/chat"
payload = {
"message": "<string>",
"ai_model_id": 123,
"conversation_id": "<string>",
"contact_id": "<string>",
"language_id": 123,
"temperature": 123,
"instructions": [{}]
}
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({
message: '<string>',
ai_model_id: 123,
conversation_id: '<string>',
contact_id: '<string>',
language_id: 123,
temperature: 123,
instructions: [{}]
})
};
fetch('https://api.chatling.ai/v2/chatbots/{chatbotId}/ai/kb/chat', 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/v2/chatbots/{chatbotId}/ai/kb/chat",
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([
'message' => '<string>',
'ai_model_id' => 123,
'conversation_id' => '<string>',
'contact_id' => '<string>',
'language_id' => 123,
'temperature' => 123,
'instructions' => [
[
]
]
]),
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/v2/chatbots/{chatbotId}/ai/kb/chat"
payload := strings.NewReader("{\n \"message\": \"<string>\",\n \"ai_model_id\": 123,\n \"conversation_id\": \"<string>\",\n \"contact_id\": \"<string>\",\n \"language_id\": 123,\n \"temperature\": 123,\n \"instructions\": [\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://api.chatling.ai/v2/chatbots/{chatbotId}/ai/kb/chat")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"message\": \"<string>\",\n \"ai_model_id\": 123,\n \"conversation_id\": \"<string>\",\n \"contact_id\": \"<string>\",\n \"language_id\": 123,\n \"temperature\": 123,\n \"instructions\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.chatling.ai/v2/chatbots/{chatbotId}/ai/kb/chat")
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 \"message\": \"<string>\",\n \"ai_model_id\": 123,\n \"conversation_id\": \"<string>\",\n \"contact_id\": \"<string>\",\n \"language_id\": 123,\n \"temperature\": 123,\n \"instructions\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"data": {
"conversation_id": "3154224116",
"response": "We offer a variety of AI models to power your chatbot. Here are the models available:\n\n- **GPT-4o**\n- **GPT-4 Turbo**\n- **GPT-3.5 Turbo**\n- **Claude 3.5 Sonnet**\n- **Claude 3 Opus**\n- **Claude 3 Sonnet**\n- **Claude 3 Haiku**\n\nThese models ensure that you can select the best fit for your specific needs and use cases.",
"sources": [
{
"type": "webpage",
"title": "Supported AI Models - Chatling Documentation",
"url": "https://docs.chatling.ai/ai/supported-ai-models"
},
{
"type": "webpage",
"title": "Pricing | Chatling",
"url": "https://chatling.ai/pricing"
},
]
}
}
AI
Chat with Knowledge Base AI
Chat with the AI using the knowledge base as the response source.
POST
/
chatbots
/
{chatbotId}
/
ai
/
kb
/
chat
Chat with Knowledge Base AI
curl --request POST \
--url https://api.chatling.ai/v2/chatbots/{chatbotId}/ai/kb/chat \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"message": "<string>",
"ai_model_id": 123,
"conversation_id": "<string>",
"contact_id": "<string>",
"language_id": 123,
"temperature": 123,
"instructions": [
{}
]
}
'import requests
url = "https://api.chatling.ai/v2/chatbots/{chatbotId}/ai/kb/chat"
payload = {
"message": "<string>",
"ai_model_id": 123,
"conversation_id": "<string>",
"contact_id": "<string>",
"language_id": 123,
"temperature": 123,
"instructions": [{}]
}
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({
message: '<string>',
ai_model_id: 123,
conversation_id: '<string>',
contact_id: '<string>',
language_id: 123,
temperature: 123,
instructions: [{}]
})
};
fetch('https://api.chatling.ai/v2/chatbots/{chatbotId}/ai/kb/chat', 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/v2/chatbots/{chatbotId}/ai/kb/chat",
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([
'message' => '<string>',
'ai_model_id' => 123,
'conversation_id' => '<string>',
'contact_id' => '<string>',
'language_id' => 123,
'temperature' => 123,
'instructions' => [
[
]
]
]),
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/v2/chatbots/{chatbotId}/ai/kb/chat"
payload := strings.NewReader("{\n \"message\": \"<string>\",\n \"ai_model_id\": 123,\n \"conversation_id\": \"<string>\",\n \"contact_id\": \"<string>\",\n \"language_id\": 123,\n \"temperature\": 123,\n \"instructions\": [\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://api.chatling.ai/v2/chatbots/{chatbotId}/ai/kb/chat")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"message\": \"<string>\",\n \"ai_model_id\": 123,\n \"conversation_id\": \"<string>\",\n \"contact_id\": \"<string>\",\n \"language_id\": 123,\n \"temperature\": 123,\n \"instructions\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.chatling.ai/v2/chatbots/{chatbotId}/ai/kb/chat")
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 \"message\": \"<string>\",\n \"ai_model_id\": 123,\n \"conversation_id\": \"<string>\",\n \"contact_id\": \"<string>\",\n \"language_id\": 123,\n \"temperature\": 123,\n \"instructions\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"data": {
"conversation_id": "3154224116",
"response": "We offer a variety of AI models to power your chatbot. Here are the models available:\n\n- **GPT-4o**\n- **GPT-4 Turbo**\n- **GPT-3.5 Turbo**\n- **Claude 3.5 Sonnet**\n- **Claude 3 Opus**\n- **Claude 3 Sonnet**\n- **Claude 3 Haiku**\n\nThese models ensure that you can select the best fit for your specific needs and use cases.",
"sources": [
{
"type": "webpage",
"title": "Supported AI Models - Chatling Documentation",
"url": "https://docs.chatling.ai/ai/supported-ai-models"
},
{
"type": "webpage",
"title": "Pricing | Chatling",
"url": "https://chatling.ai/pricing"
},
]
}
}
Request parameters
Path
string
required
The chatbot ID.
Body
string
required
The message to send to the AI.
integer
required
The ID of the AI model to use for the response. To get a list of available AI models, use the List AI models endpoint.
string
The ID of the conversation. This allows the AI to remember the context of the conversation.If left blank, a new conversation will be created.
string
The ID of the contact to associate with the conversation.
integer
default:"1"
The ID of the language to use for the AI response. To get a list of available languages, use the List languages endpoint.
float
default:"0"
The temperature to be used by the AI. The temperature controls the randomness of the response. A lower temperature value, such as 0, will make the outputs more focused and deterministic, whereas a higher temperature, such as 1, will make the responses more diverse and unpredictable.
array
List of instructions to tailor the AI’s response. It can be used to provide additional context to the AI, such as the desired tone or style of the response.Must be an array of strings.
Response
string
The status of the request. Will be
success if the request was successful, otherwise error.object
{
"status": "success",
"data": {
"conversation_id": "3154224116",
"response": "We offer a variety of AI models to power your chatbot. Here are the models available:\n\n- **GPT-4o**\n- **GPT-4 Turbo**\n- **GPT-3.5 Turbo**\n- **Claude 3.5 Sonnet**\n- **Claude 3 Opus**\n- **Claude 3 Sonnet**\n- **Claude 3 Haiku**\n\nThese models ensure that you can select the best fit for your specific needs and use cases.",
"sources": [
{
"type": "webpage",
"title": "Supported AI Models - Chatling Documentation",
"url": "https://docs.chatling.ai/ai/supported-ai-models"
},
{
"type": "webpage",
"title": "Pricing | Chatling",
"url": "https://chatling.ai/pricing"
},
]
}
}
⌘I

