DEV Community


Discussion on: Hitting a Cloud Function when you submit a Google Form

jouwert profile image
Jouwert van Geene

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:
var formResponse = event.response;

// Gets all ItemResponses contained in the form response
var itemResponses = formResponse.getItemResponses();

// Gets the actual response strings from the array of ItemResponses
var responses = getResponse(e) { return e.getResponse(); });

// Post the payload as JSON to our Cloud Function

"method": "post",
"payload": JSON.stringify({
"responses": responses

Thread Thread
jouwert profile image
Jouwert van Geene

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"