Get Data from Google Sheet
The API for using Google Sheets with app.neoagent.co provides functionality to obtain a sheet by sending a GET request to the endpoint /chat/Chatbot/GetGoogleGoolgeSheetData.
warning
Warning: this API is compatible only with traditional chatbots and is not yet compatible with template-based chatbots.
Endpoint
Request URL: https://app.neoagent.co/chat/Chatbot/GetGoogleGoolgeSheetData
Method: GET
Request Body
The request body must contain the following parameters:
{
// string, mandatory - Unique identifier (ID) of the chatbot
"serialNumber": "3254a9d0424c4806b9ea3d0763xxxxxx",
// array of integers, optional - List of IDs of data to retrieve
"ids": [
1,
2
],
// integer, optional - Maximum number of items to return per page, the default value is 10
"pageSize": 10,
// integer, optional - Page number to retrieve, the default value is 1
"pageNumber": 1,
// boolean, optional - Indicates whether the results should be sorted in ascending order, the default value is true
"isASC": true
}
Parameters
serialNumber- string, mandatory - Unique identifier (ID) of the chatbotids- array of integers, optional - List of IDs of data to retrievepageSize- integer, optional - Maximum number of items to return per page, the default value is 10pageNumber- integer, optional - Page number to retrieve, the default value is 1isASC- boolean, optional - Indicates whether the results should be sorted in ascending order, the default value is true
Required Headers
The API request must include the following headers:
Authorization: <Your-Secret-Key>- string, mandatory - The secret key to authenticate the API requestContent-Type: application/json- string, mandatory - The content type of the request payload (must be application/json)
Request Examples
- JavaScript (Fetch API)
- Python (Requests)
- cURL
- HTTP Raw
const res = await fetch('https://app.neoagent.co/chat/Chatbot/GetSource', {
method: 'GET',
headers: {
"Authorization": "<Your-Secret-Key>",
"Content-Type": "application/json"
},
body: JSON.stringify({
"serialNumber": "3254a9d0424c4806b9ea3d0763xxxxxx"
})
});
const data = await res.json();
console.log(data);
import requests
import json
url = 'https://app.neoagent.co/chat/Chatbot/GetSource'
headers = {
"Authorization": "<Your-Secret-Key>",
"Content-Type": "application/json"
}
data = {
"serialNumber": "3254a9d0424c4806b9ea3d0763xxxxxx"
}
response = requests.get(url, headers=headers, json=data)
data = response.json()
print(data)
curl 'https://app.neoagent.co/chat/Chatbot/GetSource' \
-X GET \
-H 'Authorization: <Your-Secret-Key>' \
-H 'Content-Type: application/json' \
-d '{"serialNumber":"3254a9d0424c4806b9ea3d0763xxxxxx"}'
GET /chat/Chatbot/GetSource HTTP/1.1
Host: app.neoagent.co
Authorization: <Your-Secret-Key>
Content-Type: application/json
{
"serialNumber": "3254a9d0424c4806b9ea3d0763xxxxxx"
}
Response
The API response will be a JSON object with the following structure:
{
// object - Represents the results of the query divided into pages.
// In each element of the list, the ID field serves as a unique identifier for each row of data.
// It is important to note that fields such as URL, name, product name, and price are dynamic custom fields.
// Their definitions and values are determined by the user and can be modified based on specific requirements.
"Data": {
"List": [
{
"ID": 1,
"url": "XXXXX",
"name": "xiaomi",
"productName": "xiaomi 16",
"price": 999
},
{
"ID": 2,
"url": "XXXXX",
"name": "apple",
"productName": "iphone 16 pro max",
"price": 999
}
],
"VirtualCount": 2
},
// string - API Version
"Version": "1.0.0",
// boolean - Status of operation success
"Success": true,
// integer - HTTP status code
"Code": 200,
// string - Error message, if present
"Message": ""
}
Error Handling
If the request fails, you should:
- Check the HTTP status code for network-level errors
- Examine the
CodeandMessagefields in the response for business-level errors - The
Messagefield will contain detailed information about the error.