// Gets all ItemResponses contained in the form response
// developers.google.com/apps-script/...
var itemResponses = formResponse.getItemResponses();
// Gets the actual response strings from the array of ItemResponses
var responses = itemResponses.map(function getResponse(e) { return e.getResponse(); });
The trigger script in my google form is
// Replace with the URL to your deployed Cloud Function
var url = "us-central1-inspired-rush-271907.c..."
// This function will be called when the form is submitted
function onSubmit(event) {
// The event is a FormResponse object:
// developers.google.com/apps-script/...
var formResponse = event.response;
// Gets all ItemResponses contained in the form response
// developers.google.com/apps-script/...
var itemResponses = formResponse.getItemResponses();
// Gets the actual response strings from the array of ItemResponses
var responses = itemResponses.map(function getResponse(e) { return e.getResponse(); });
// Post the payload as JSON to our Cloud Function
UrlFetchApp.fetch(
url,
{
"method": "post",
"payload": JSON.stringify({
"responses": responses
})
});
};
But maybe the Cloud Function is wrong. I was not so sure as to how to implement this script from your instruction:
def form_trigger(request):
payload = request.get_json(silent=True)
print(f"Payload was: {payload}")
return "OK"