Setting Up Webhook Integration for Google Forms

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:
- Click the three-dot menu (⋮) in the top-right corner
- Select “Script editor” from the dropdown menu
- 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:
- Click the “Run” button in the Apps Script editor
- Grant necessary permissions when prompted
- Check your webhook endpoint to confirm data was received
- Review the execution log for any error messages

6. Configure the Form Trigger

Set up automatic execution when forms are submitted:
- In the Apps Script editor, click the trigger in the left sidebar
- Click “+ Add Trigger”
- Configure the trigger settings:
- Function to run:
handleFormSubmission
- Deployment: Head
- Event source: From form
- Event type: On form submit
- Function to run:
- Click “Save”

7. Deploy Your Script
Make the script active:

- Click “Deploy” → “New deployment”
- Click the gear icon and select “Web app”
- Add an optional description
- Set execution settings:
- Execute as: Me
- Who has access: Anyone
- Click “Deploy”
- Authorize the application when prompted
Verification
Your Google Form now automatically sends webhook notifications! Test it by:
- Submitting a new response to your form
- Checking your webhook endpoint for the incoming data
- Monitoring the Apps Script logs for successful executions
Summary of Steps
- Form Preparation: Create or modify your Google Form
- Endpoint Setup: Prepare your webhook receiving URL
- Script Creation: Add the webhook code to Apps Script
- Testing: Verify the script executes correctly
- Trigger Configuration: Set up automatic execution on form submission
- 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!