cURL
curl --request POST \
--url https://api.public.chatnode.ai/v1/{bot_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"message": "<string>",
"chat_session_id": "<string>",
"streaming": false
}
'import requests
url = "https://api.public.chatnode.ai/v1/{bot_id}"
payload = {
"message": "<string>",
"chat_session_id": "<string>",
"streaming": False
}
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>', chat_session_id: '<string>', streaming: false})
};
fetch('https://api.public.chatnode.ai/v1/{bot_id}', 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.public.chatnode.ai/v1/{bot_id}",
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>',
'chat_session_id' => '<string>',
'streaming' => false
]),
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.public.chatnode.ai/v1/{bot_id}"
payload := strings.NewReader("{\n \"message\": \"<string>\",\n \"chat_session_id\": \"<string>\",\n \"streaming\": false\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.public.chatnode.ai/v1/{bot_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"message\": \"<string>\",\n \"chat_session_id\": \"<string>\",\n \"streaming\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.public.chatnode.ai/v1/{bot_id}")
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 \"chat_session_id\": \"<string>\",\n \"streaming\": false\n}"
response = http.request(request)
puts response.read_body{
"message": "Hello there! 😄 How can I assist you today?",
"chat_session_id": "aki56d7-1719768767426",
"id": "d0135d64-2f4b-4a79-9b29-af76e4ea93a7",
"urls": [],
"docs": []
}{
"message": [
"body"
],
"chat_session_id": [
"<string>"
],
"streaming": [
"<string>"
]
}{
"message": "Bearer token missing or unknown"
}{
"message": "Bot access not allowed"
}API
Send Message
Use this endpoint to send queries or prompts to your trained agent and receive immediate, accurate responses.
POST
/
{bot_id}
cURL
curl --request POST \
--url https://api.public.chatnode.ai/v1/{bot_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"message": "<string>",
"chat_session_id": "<string>",
"streaming": false
}
'import requests
url = "https://api.public.chatnode.ai/v1/{bot_id}"
payload = {
"message": "<string>",
"chat_session_id": "<string>",
"streaming": False
}
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>', chat_session_id: '<string>', streaming: false})
};
fetch('https://api.public.chatnode.ai/v1/{bot_id}', 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.public.chatnode.ai/v1/{bot_id}",
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>',
'chat_session_id' => '<string>',
'streaming' => false
]),
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.public.chatnode.ai/v1/{bot_id}"
payload := strings.NewReader("{\n \"message\": \"<string>\",\n \"chat_session_id\": \"<string>\",\n \"streaming\": false\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.public.chatnode.ai/v1/{bot_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"message\": \"<string>\",\n \"chat_session_id\": \"<string>\",\n \"streaming\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.public.chatnode.ai/v1/{bot_id}")
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 \"chat_session_id\": \"<string>\",\n \"streaming\": false\n}"
response = http.request(request)
puts response.read_body{
"message": "Hello there! 😄 How can I assist you today?",
"chat_session_id": "aki56d7-1719768767426",
"id": "d0135d64-2f4b-4a79-9b29-af76e4ea93a7",
"urls": [],
"docs": []
}{
"message": [
"body"
],
"chat_session_id": [
"<string>"
],
"streaming": [
"<string>"
]
}{
"message": "Bearer token missing or unknown"
}{
"message": "Bot access not allowed"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The agent id associated with the trained agent model.
Body
application/json
Response
Message response
The reply message from your agent.
Example:
"Hello there! 😄 How can I assist you today?"
The chat session id to keep track of a unique conversation.
Example:
"aki56d7-1719768767426"
The unique identifier for the message.
Example:
"d0135d64-2f4b-4a79-9b29-af76e4ea93a7"
URLs related to the message.
Example:
[]
document links related to the message.
Example:
[]
