Skip to main content

Update Google Sheet Data

The API enables you to update google sheet data for a specified chatbot by sending a POST request to the /chat/Chatbot/UpdateGoogleSheetData endpoint.

⚠️ Attention: This API is only compatible with regular chatbots and is not yet compatible with template-based chatbots.

Endpoint

Request URL: https://usapi.hottask.com/chat/Chatbot/UpdateGoogleSheetData

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": "3254a9d0424c4806b9ea3d0763xxxxxx",
// array of object, required - List of data rows to update, field ID is required for update.
// Each ID represents the ID of the data row that needs to be updated, and Data is a dynamic object that users can customize according to their needs.
"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
}
}
]
}
  • serialNumber - string, required - The unique identifier (ID) of the chatbot
  • rows - array of object, required - List of data rows to update, field ID is required for update. // Each ID represents the ID of the data row that needs to be updated, and Data is a dynamic object that users can customize according to their needs.

Example Request

JavaScript (Fetch API)

const res = await fetch('https://usapi.hottask.com/chat/Chatbot/GetSource', {
method: 'POST',
headers: {
"Authorization": "<Your-Secret-Key>",
"Content-Type": "application/json"
},
body: JSON.stringify({
"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
}
}
]
})
});

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

Python (Requests Library)

import requests
import json

url = 'https://usapi.hottask.com/chat/Chatbot/GetSource'
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

curl 'https://usapi.hottask.com/chat/Chatbot/GetSource' \
-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}}]}'

HTTP Request

POST /chat/Chatbot/GetSource HTTP/1.1
Host: usapi.hottask.com
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 integer - Represents the data row ids that were updated.
"Data": [
1,
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