Skip to content

Instantly share code, notes, and snippets.

@benkoshy
Last active July 4, 2025 03:33
Show Gist options
  • Save benkoshy/10ac018451f8a33106f1fe39ffac4679 to your computer and use it in GitHub Desktop.
Save benkoshy/10ac018451f8a33106f1fe39ffac4679 to your computer and use it in GitHub Desktop.
Google Scripts API - OnSubmit
function onSubmit(e) {
// some work is done here:
// var form = FormApp.getActiveForm();
// var allResponses = form.getResponses();
// var latestResponse = allResponses[allResponses.length - 1];
// var response = latestResponse.getItemResponses();
// var payload = {};
// for (var i = 0; i < response.length; i++) {
// var question = response[i].getItem().getTitle();
// var answer = response[i].getResponse();
// payload[question] = answer;
// }
//
// var options = {
// "method": "post",
// "contentType": "application/json",
// "payload": JSON.stringify(payload)
// };
//
submit_to_current_workflow(options); // this is how you are presumably currently triggering?
//
submit_to_wonko_workflow(options); // add in this line here. This should not affect anything in your current workflow.
};
function submit_to_current_workflow(options){
let POST_URL = "enter your current web-hook-url URL";
UrlFetchApp.fetch(POST_URL, options);
}
function submit_to_wonko_workflow(options){
console.log("wonko is in business!")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment