Created
July 17, 2019 12:08
-
-
Save ashokrane/ba52bcde44d4780cdf6cec25d60988ae to your computer and use it in GitHub Desktop.
Google script for listening to WooCommerce Webhook & parse order information to add to Google sheet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//this is a function that fires when the webapp receives a GET request | |
function doGet(e) { | |
return HtmlService.createHtmlOutput("request received"); | |
} | |
//this is a function that fires when the webapp receives a POST request | |
function doPost(e) { | |
var myData = JSON.parse([e.postData.contents]); | |
var order_number = myData.number; | |
var order_created = myData.date_created; | |
var order_status = myData.status; | |
var timestamp = new Date(); | |
var sheet = SpreadsheetApp.getActiveSheet(); | |
sheet.appendRow([timestamp,order_number,order_created,order_status]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment