Skip to main content

Google Sheets

Apply Changes Immediately in Google Sheets

Click "Apps Script"

- Rename Project - Click "Untitled product"

Set CallNewOaks Function

Replace the serial number value with your chatbot ID within the "callNewOaks" function and copy the function to replace the default function under "Code.gs" section

'serialNumber': '<YOUR_SERIAL_NUMBER>' The value of this "serialNumber" is located in Chatbot -> Settings -> General -> Chatbot ID.

// Replace <YOUR_SERIAL_NUMBER> with your chatbot ID.
function callNewOaks(e) {
var url = SpreadsheetApp.getActiveSpreadsheet().getUrl();
var options = {
method: 'post',
contentType: 'application/x-www-form-urlencoded',
payload: {
googleSheetUrl: url,
serialNumber: '<YOUR_SERIAL_NUMBER>'
}
};
var response = UrlFetchApp.fetch(
'https://usapi.hottask.com/chat/chatbot/googlesheetedithook',
options
);
if (response.getResponseCode() == 200) {
var content_text = response.getContentText();
if (JSON.parse(content_text).Succescc == false)
throw new Error('http response not succescc');
} else throw new Error('http response code ' + response.getResponseCode());
}

Save Project

- Run the selected function - Click "Review permissions" - Choose an account - Click "Go to NewOaks AI(unsafe)" - Click "Allow"

Add triggers

  • click "Triggers" - create a new trigger - Add Trigger for NewOaks AI - Choose an account

Verify data synchronization

You can modify the content of the Google Sheet and check whether the chatbot data is effective after 15 minutes.