APTalkmoji Google Sheets
Docs›Integrations

Google Sheets

One row per lead, in a sheet you own. You publish a tiny Google Apps Script; we post each lead to it.

1. Add the script

Open your Google Sheet → Extensions → Apps Script, replace everything with this, and save:

function doPost(e) {
  var data = JSON.parse(e.postData.contents);
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  var keys = Object.keys(data);
  if (sheet.getLastRow() === 0) sheet.appendRow(keys);
  var header = sheet.getRange(1, 1, 1, sheet.getLastColumn()).getValues()[0];
  keys.forEach(function (k) {
    if (header.indexOf(k) === -1) { sheet.getRange(1, header.length + 1).setValue(k); header.push(k); }
  });
  sheet.appendRow(header.map(function (h) { return data[h] == null ? '' : String(data[h]); }));
  return ContentService.createTextOutput('ok');
}

2. Publish it

Deploy → New deployment → Web app. Set Execute as: Me and Who has access: Anyone. Copy the Web app URL (it ends in /exec).

3. Connect it

Chatbot → Leads → Send leads to your CRM → Google Sheets: paste the URL, Connect, then Send test lead. Each lead adds a row with timestamp, chatbot, your form's fields (their keys become the column names) and the conversation transcript.

⚠️

"Anyone" means anyone who has the long secret URL can add a row. Keep the URL private. If it leaks, deploy a new version and paste the new URL.