Chatbot Message Count
The Neoagent API allows you to obtain the number of messages in the history of a specific chatbot by sending a POST request to the /chat/Chatbot/GetMessageCountByChatbot endpoint.
Endpoint
Request URL: https://app.neoagent.co/chat/Chatbot/GetMessageCountByChatbot
Method: POST
Required Headers
Authorization: <Your-Secret-Key>- string, mandatory - The secret key to authenticate the API request
Request Body
{
"SerialNumber": "36XXGxiYDigrQgg5xz4n45bcBW7qeYyW35"
}
Parameters
SerialNumber- string, mandatory - The unique identifier of the chatbot
Request Examples
- JavaScript (Fetch API)
- Python (Requests)
- cURL
- HTTP Raw
const res = await fetch('https://app.neoagent.co/chat/Chatbot/GetMessageCountByChatbot', {
method: 'POST',
headers: {
"Authorization": "<Your-Secret-Key>"
},
body: JSON.stringify({
"SerialNumber": "36XXGxiYDigrQgg5xz4n45bcBW7qeYyW35"
})
});
const data = await res.json();
console.log(data);
import requests
import json
url = 'https://app.neoagent.co/chat/Chatbot/GetMessageCountByChatbot'
headers = {
"Authorization": "<Your-Secret-Key>"
}
data = {
"SerialNumber": "36XXGxiYDigrQgg5xz4n45bcBW7qeYyW35"
}
response = requests.post(url, headers=headers, json=data)
data = response.json()
print(data)
curl 'https://app.neoagent.co/chat/Chatbot/GetMessageCountByChatbot' \
-X POST \
-H 'Authorization: <Your-Secret-Key>' \
-d '{"SerialNumber":"36XXGxiYDigrQgg5xz4n45bcBW7qeYyW35"}'
POST /chat/Chatbot/GetMessageCountByChatbot HTTP/1.1
Host: app.neoagent.co
Authorization: <Your-Secret-Key>
{
"SerialNumber": "36XXGxiYDigrQgg5xz4n45bcBW7qeYyW35"
}
Response
The API response will be a JSON object with the following structure:
{
// int - Number of messages for the chatbot
"Data": 13,
// string - API version
"Version": "1.0.0",
// boolean - Success status of the operation
"Success": true,
// integer - HTTP status code
"Code": 200,
// string - Error message if present
"Message": ""
}
Response Fields
Data- integer - Total number of messages in the chatbot's historyVersion- string - Version of the API usedSuccess- boolean - Indicates whether the operation was successfulCode- integer - HTTP status codeMessage- string - Error message or additional information