Created
October 24, 2013 14:13
-
-
Save bmeck/7138043 to your computer and use it in GitHub Desktop.
boilerplate for turning google forms into a webhook
This file contains 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
function onResponse(e) { | |
var formResponse = e.response; | |
var itemResponses = formResponse.getItemResponses(); | |
var data = {}; | |
for (var j = 0; j < itemResponses.length; j++) { | |
var itemResponse = itemResponses[j]; | |
var key = itemResponse.getItem().getTitle(); | |
var value = itemResponse.getResponse(); | |
data[key] = value; | |
} | |
Logger.log(data); | |
var options = { | |
method: "post", | |
payload: JSON.stringify(data, null, 2) | |
}; | |
// FILL ME IN | |
UrlFetchApp.fetch("http://...", options); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment