View Categories

Lead/Appointment Data API

1 min read

The chat.smarterbot.ai API enables you to retrieve Lead/Appointment data by sending a POST request to the /chat/Chatbot/LeadList endpoint.

Endpoint #

Request URL: https://chat.smarterbot.ai/chat/Chatbot/LeadList

Method: POST

Request Headers #

The API request must include the following headers:

  • Authorization: <Your-Secret-Key> – string, required – The secret key for authenticating the API request
  • Content-Type: application/json – string, required – The content type of the request payload (must be application/json)

Request Body #

The request body should contain the following parameters:

{
// string, required - The unique identifier (ID) of the chatbot
"serialNumber": "3254a9d0424c4806b9ea3d0763ccfxxx",
// string, optional - Start date for filtering (format: YYYY-MM-DD)
"startTime": "2025-01-01",
// string, optional - End date for filtering (format: YYYY-MM-DD)
"endTime": "2025-02-01",
// integer, optional - Session ID to filter specific conversations
"sessionID": 1111
}
  • serialNumber – string, required – The unique identifier (ID) of the chatbot
  • startTime – string, optional – Start date for filtering (format: YYYY-MM-DD)
  • endTime – string, optional – End date for filtering (format: YYYY-MM-DD)
  • sessionID – integer, optional – Session ID to filter specific conversations

Example Request #

JavaScript (Fetch API) #

const res = await fetch('https://chat.smarterbot.ai/chat/Chatbot/LeadList', {
method: 'POST',
headers: {
"Authorization": "<Your-Secret-Key>",
"Content-Type": "application/json"
},
body: JSON.stringify({
"serialNumber": "3254a9d0424c4806b9ea3d0763ccfxxx",
"startTime": "2025-01-01",
"endTime": "2025-02-01"
})
});

const data = await res.json();
console.log(data);

Python (Requests Library) #

import requests
import json

url = 'https://chat.smarterbot.ai/chat/Chatbot/LeadList'
headers = {
"Authorization": "<Your-Secret-Key>",
"Content-Type": "application/json"
}
data = {
"serialNumber": "3254a9d0424c4806b9ea3d0763ccfxxx",
"startTime": "2025-01-01",
"endTime": "2025-02-01"
}

response = requests.post(url, headers=headers, json=data)
data = response.json()
print(data)

cURL #

curl 'https://chat.smarterbot.ai/chat/Chatbot/LeadList' \
-X POST \
-H 'Authorization: <Your-Secret-Key>' \
-H 'Content-Type: application/json' \
-d '{"serialNumber":"3254a9d0424c4806b9ea3d0763ccfxxx","startTime":"2025-01-01","endTime":"2025-02-01"}'

HTTP Request #

POST /chat/Chatbot/LeadList HTTP/1.1
Host: chat.smarterbot.ai
Authorization: <Your-Secret-Key>
Content-Type: application/json

{
"serialNumber": "3254a9d0424c4806b9ea3d0763ccfxxx",
"startTime": "2025-01-01",
"endTime": "2025-02-01"
}

Response #

The API response will be a JSON object with the following structure:

{
// array - List of leads and appointments
"Data": [
{
"Type": "Lead",
"Name": "test",
"Email": "test@qq.com",
"PhoneNumber": "",
"CreateTime": "2023-11-23T18:36:21.512302-08:00",
"Content": "test",
"SessionID": 31305,
"URI": "www.xxx.com",
"Count": 2
},
{
"Type": "Appointment",
"Name": "test444",
"Email": "test444@qq.com",
"PhoneNumber": "",
"CreateTime": "2023-11-21T19:13:44.054019-08:00",
"Content": "Please share anything",
"SessionID": 31313,
"URI": "www.xxx.com",
"Count": 2
}
],
// 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": ""
}

Error Handling #

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

Leave a Reply

Your email address will not be published. Required fields are marked *