2 min read
The chat.smarterbot.ai API enables you to generate an AI response based on the user’s question by sending a POST request to the /chat/Chat/ClientAsk endpoint.
chat.smarterbot.ai
POST
/chat/Chat/ClientAsk
Request URL: https://chat.smarterbot.ai/chat/Chat/ClientAsk
Method: POST
The API request must include the following headers:
Authorization: <Your-Secret-Key>
Content-Type: application/json
The request body should contain the following parameters:
{ // integer, required - The session ID obtained from the Create Chat Session API "sessionID": 123, // string, required - The question or message from the user "content": "hello"}
sessionID
content
const res = await fetch('https://chat.smarterbot.ai/chat/Chat/ClientAsk', { method: 'POST', headers: { "Authorization": "<Your-Secret-Key>", "Content-Type": "application/json"}, body: JSON.stringify({ "sessionID": 123, "content": "hello"})});const data = await res.json();console.log(data);
import requestsimport jsonurl = 'https://chat.smarterbot.ai/chat/Chat/ClientAsk'headers = { "Authorization": "<Your-Secret-Key>", "Content-Type": "application/json"}data = { "sessionID": 123, "content": "hello"}response = requests.post(url, headers=headers, json=data)data = response.json()print(data)
curl 'https://chat.smarterbot.ai/chat/Chat/ClientAsk' \ -X POST \ -H 'Authorization: <Your-Secret-Key>' \ -H 'Content-Type: application/json' \ -d '{"sessionID":123,"content":"hello"}'
POST /chat/Chat/ClientAsk HTTP/1.1Host: chat.smarterbot.aiAuthorization: <Your-Secret-Key>Content-Type: application/json{ "sessionID": 123, "content": "hello"}
The API response will be a JSON object with the following structure:
{ "Data": { "messageid": 375561, "content": "I'm here to help you with appointments and reservations. If you have any questions related to that, feel free to ask!", "totalToken": 4337 }, // string - API version "Version": "1.0.0", // boolean - Operation success status "Success": true, // integer - HTTP status code "Code": 200, // string - Error message if any "Message": ""}
If the request fails, you should: 1. Check the HTTP status code for network-level errors 2. Examine the `Code` and `Message` fields in the response for business-level errors 3. The `Message` field will contain detailed error information
Your email address will not be published. Required fields are marked *
Comment *
Name *
Email *
Website
Save my name, email, and website in this browser for the next time I comment.
Post Comment