Setting Up Webhook Integration for Google Forms

Published Aug 12 2025Updated Aug 12 2025

Learn how to automatically send data from your Google Forms to external services using webhooks. This tutorial will walk you through creating a Google Apps Script that triggers whenever someone submits your form.

Requirement

Before starting, ensure you have:

  • A Google account with access to Google Forms
  • A webhook endpoint URL (destination for your data)
  • Basic understanding of what webhooks do (they send data automatically when events occur)

Implementation Guide

1. Set Up Your Google Form

Begin by preparing your form:

  • Create a new Google Form or open an existing one
  • Add the questions you need for data collection
  • Consider submitting a test response to verify everything works
  • Once your form is ready, move on to adding a script.

2. Obtain Your Webhook Destination

You’ll need a valid endpoint URL where the form data will be sent. This could be:

3. Access the Apps Script Editor

From your Google Form:

  1. Click the three-dot menu (⋮) in the top-right corner
  2. Select “Script editor” from the dropdown menu
  3. A new tab will open with Google Apps Script

4. Implement the Webhook Script

Replace any existing code in the script editor with this custom function:

const WEBHOOK_URL = "YOUR_ENDPOINT_URL_HERE";

function handleFormSubmission(event) {
    const form = FormApp.getActiveForm();
    const responses = form.getResponses();
    const mostRecentResponse = responses[responses.length - 1];
    const answers = mostRecentResponse.getItemResponses();
    
    const formData = {};
    
    answers.forEach(function(answer) {
        const questionTitle = answer.getItem().getTitle();
        const responseValue = answer.getResponse();
        formData[questionTitle] = responseValue;
    });
    
    const requestOptions = {
        method: "POST",
        headers: {
            "Content-Type": "application/json"
        },
        payload: JSON.stringify(formData)
    };
    
    try {
        UrlFetchApp.fetch(WEBHOOK_URL, requestOptions);
        console.log("Webhook sent successfully");
    } catch (error) {
        console.error("Failed to send webhook:", error);
    }
}

Important: Replace YOUR_ENDPOINT_URL_HERE with your actual webhook URL.

Save your script using Ctrl+S (or Cmd+S on Mac).

5. Test the Integration

Verify your script works correctly:

  1. Click the “Run” button in the Apps Script editor
  2. Grant necessary permissions when prompted
  3. Check your webhook endpoint to confirm data was received
  4. Review the execution log for any error messages

6. Configure the Form Trigger

Set up automatic execution when forms are submitted:

  1. In the Apps Script editor, click the trigger in the left sidebar
  2. Click “+ Add Trigger”
  3. Configure the trigger settings:
    • Function to run: handleFormSubmission
    • Deployment: Head
    • Event source: From form
    • Event type: On form submit
  4. Click “Save”

7. Deploy Your Script

Make the script active:

  1. Click “Deploy” → “New deployment”
  2. Click the gear icon and select “Web app”
  3. Add an optional description
  4. Set execution settings:
    • Execute as: Me
    • Who has access: Anyone
  5. Click “Deploy”
  6. Authorize the application when prompted

Verification

Your Google Form now automatically sends webhook notifications! Test it by:

  1. Submitting a new response to your form
  2. Checking your webhook endpoint for the incoming data
  3. Monitoring the Apps Script logs for successful executions

Summary of Steps

  1. Form Preparation: Create or modify your Google Form
  2. Endpoint Setup: Prepare your webhook receiving URL
  3. Script Creation: Add the webhook code to Apps Script
  4. Testing: Verify the script executes correctly
  5. Trigger Configuration: Set up automatic execution on form submission
  6. Deployment: Activate the script as a web application

Troubleshooting Tips

  • Ensure your webhook URL is accessible and accepts POST requests
  • Check the Apps Script execution logs if webhooks aren’t being sent
  • Verify that the trigger is properly configured and saved
  • Test with a simple webhook testing service first before using complex endpoints

Your Google Form will now seamlessly integrate with external services through webhooks!