Skip to main content

Create Google Sheet

The API for using Google Sheet with app.neoagent.co provides the functionality to create a new sheet by sending a POST request to the endpoint /chat/Chatbot/CreateGoogleSheetData.

warning

Attention: 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/CreateGoogleSheetData
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 request
  • Content-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": "73d5f91231174c04b584337bxxxx",
// array of objects, required - List of Google Sheet data.
// In each row element, fields like URL, name, product name, and price are dynamically customizable fields.
// Their definitions and values are determined by the user and can be modified based on specific requirements.
"rows": [
{
"url": "XXXXX",
"name": "xiaomi",
"productname": "xiaomi 16",
"price": 999
},
{
"url": "XXXXX",
"name": "apple",
"productname": "iphone 16 pro max",
"price": 999
}
]
}

Parameters

  • serialNumber - string, required - Unique identifier (ID) of the chatbot
  • rows - array of objects, required - List of Google Sheet data. // In each row element, fields like URL, name, product name, and price are dynamically customizable fields. // Their definitions and values are determined by the user and can be modified based on specific requirements.

Request Examples

const res = await fetch('https://app.neoagent.co/chat/Chatbot/CreateGoogleSheetData', {
method: 'POST',
headers: {
"Authorization": "<Your-Secret-Key>",
"Content-Type": "application/json"
},
body: JSON.stringify({
"serialNumber": "3254a9d0424c4806b9ea3d0763xxxxxx",
"rows": [
{
"url": "XXXXX",
"name": "xiaomi",
"productname": "xiaomi 16",
"price": 999
},
{
"url": "XXXXX",
"name": "apple",
"productname": "iphone 16 pro max",
"price": 999
}
]
})
});

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

Response

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

{
// array of objects - Represents the data created in the Google Sheet. [].ID Represents the ID of the data
"Data": [
{
"ID": 1,
"url": "XXXXX",
"name": "xiaomi",
"productname": "xiaomi 16",
"price": 999
},
{
"ID": 2,
"url": "XXXXX",
"name": "apple",
"productname": "iphone 16 pro max",
"price": 999
}
],
// 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 any
"Message": ""
}

Error Handling

If the request fails, you should:

  1. Check the HTTP status code for network-level errors
  2. Examine the fields Code and Message in the response for business-level errors
  3. The Message field will contain detailed information about the error.