Skip to content

Instantly share code, notes, and snippets.

@roundrop
Created November 11, 2022 02:12
Show Gist options
  • Save roundrop/e46674806184d7da8e9a81b3e2a3826c to your computer and use it in GitHub Desktop.
Save roundrop/e46674806184d7da8e9a81b3e2a3826c to your computer and use it in GitHub Desktop.
App Script that receives webhook requests and records them in a Google Spreadsheet.
function doPost(e) {
const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheets()[0];
sheet.getRange("1:1").insertCells(SpreadsheetApp.Dimension.ROWS);
sheet.getRange(1, 1).setValue((new Date).toLocaleString('ja-JP'));
sheet.getRange(1, 2).setValue(e.postData.contents);
// send 200 OK status back to confirm receiving webhook
var response = HtmlService.createHtmlOutput();
return response;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment