Delete Data from Google Sheet
The API for using Google Sheets with app.neoagent.co provides functionality to delete data by sending a POST request to the endpoint /chat/Chatbot/DeleteGoogleSheetData.
warning
Warning: This API is only compatible with traditional chatbots and is not yet compatible with template-based chatbots.
Endpoint
Request URL: https://app.neoagent.co/chat/Chatbot/DeleteGoogleSheetData
Method: POST
Required Headers
The API request must include the following headers:
Authorization: <Your-Secret-Key>- string, required - The secret key to authenticate the API requestContent-Type: application/json- string, required - The content type of the request payload (must be application/json)
Request Body
The request body must contain the following parameters:
{
// string, required - Unique identifier (ID) of the chatbot
"serialNumber": "3254a9d0424c4806b9ea3d0763xxxxxx",
// array of integers, optional - List of data IDs to delete.
// If this array is empty, all Google Sheet data associated with the chatbot will be deleted.
"ids": [
1,
2
]
}
Parameters
serialNumber- string, required - Unique identifier (ID) of the chatbotrows- array of objects, required - List of Google Sheet data. //In each row element, fields like URL, name, product name, and price are dynamically defined custom fields. //Their definitions and values are determined by the user and can be modified based on specific requirements.
Request Examples
- JavaScript (Fetch API)
- Python (Requests)
- cURL
- HTTP Raw
const res = await fetch('https://app.neoagent.co/chat/Chatbot/DeleteGoogleSheetData', {
method: 'POST',
headers: {
"Authorization": "<Your-Secret-Key>",
"Content-Type": "application/json"
},
body: JSON.stringify({
"serialNumber": "3254a9d0424c4806b9ea3d0763xxxxxx",
"ids": [
1,
2
]
})
});
const data = await res.json();
console.log(data);
import requests
import json
url = 'https://app.neoagent.co/chat/Chatbot/DeleteGoogleSheetData'
headers = {
"Authorization": "<Your-Secret-Key>",
"Content-Type": "application/json"
}
data = {
"serialNumber": "3254a9d0424c4806b9ea3d0763xxxxxx",
"rows": [
{
"ID": 1,
"Data": {
"url": "XXXXX",
"name": "apple",
"productname": "iphone 16 pro max",
"price": 111
}
},
{
"ID": 2,
"Data": {
"url": "XXXXX",
"name": "xiaomi",
"productname": "xiaomi 16",
"price": 111
}
}
]
}
response = requests.post(url, headers=headers, json=data)
data = response.json()
print(data)
curl 'https://app.neoagent.co/chat/Chatbot/DeleteGoogleSheetData' \
-X POST \
-H 'Authorization: <Your-Secret-Key>' \
-H 'Content-Type: application/json' \
-d '{"serialNumber":"3254a9d0424c4806b9ea3d0763xxxxxx","rows":[{"ID":1,"Data":{"url":"XXXXX","name":"apple","productname":"iphone 16 pro max","price":111}},{"ID":2,"Data":{"url":"XXXXX","name":"xiaomi","productname":"xiaomi 16","price":111}}]}'
POST /chat/Chatbot/DeleteGoogleSheetData HTTP/1.1
Host: app.neoagent.co
Authorization: <Your-Secret-Key>
Content-Type: application/json
{
"serialNumber": "3254a9d0424c4806b9ea3d0763xxxxxx",
"rows": [
{
"ID": 1,
"Data": {
"url": "XXXXX",
"name": "apple",
"productname": "iphone 16 pro max",
"price": 111
}
},
{
"ID": 2,
"Data": {
"url": "XXXXX",
"name": "xiaomi",
"productname": "xiaomi 16",
"price": 111
}
}
]
}
Response
The API response will be a JSON object with the following structure:
{
// array of integers - Represents the IDs of the data rows that have been updated.
"Data": [
1,
2
],
// 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": ""
}
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