Overview
In this lesson, you will learn how to connect Google Forms with n8n using the Webhook node. Google Forms does not natively support webhook integration, so you will explore a practical workaround using Google Apps Script to send form responses to an n8n Webhook URL. This tutorial covers setting up the webhook trigger in n8n, configuring Google Forms with Apps Script, and building a workflow that routes responses based on form data.
For further data transformation after receiving the webhook data, consider using the Set Node in n8n to format or rename fields as needed.
Understanding Webhooks vs APIs
Before diving into the setup, it's essential to understand what a webhook is and how it differs from a traditional API or polling mechanism:
- API Polling: Your workflow repeatedly requests data from an external system at intervals to check for updates. This is inefficient and can cause delays.
- Webhook: The external system pushes data to your workflow instantly when an event occurs (e.g., form submission), enabling real-time automation.
Real-world analogy:
Polling is like repeatedly calling customer service to check if your package has arrived, while a webhook is like receiving an immediate alert the moment your package is delivered.
Using webhooks in your n8n workflows allows instant reaction to events such as Google Form submissions, CRM updates, or security incidents without wasting resources on constant checks. This approach is often combined with nodes like the Merge Node in n8n to consolidate data streams efficiently.
Step 1: Create a Webhook Trigger in n8n
- Log into your n8n workspace.
- Create a new workflow (
+ New Workflow). - Add a Webhook node by searching for
Webhookin the nodes panel. - Configure the Webhook node:
- Set the HTTP Method to
POST(because Google Forms will send data to n8n). - The node will generate two URLs:
- Test URL: Use this to test your workflow during development.
- Production URL: Use this when deploying to production.
- Leave Authentication as
None. - Set Response Mode to
On Received(respond immediately after receiving data).
- Set the HTTP Method to
- Click Save and name your workflow (e.g.,
Google Forms Webhook Integration). - Click Execute Node → Listen for Incoming Requests to start listening for test events.
Note: You must keep the webhook node listening to receive data during testing.
Step 2: Create and Configure Your Google Form
- Open Google Forms in a browser (preferably incognito/private mode to avoid cookie conflicts).
- Click Blank or New Form to create a fresh form.
- Set the form title (e.g.,
User Registration). - Add questions:
- Name (Short answer)
- Email (Short answer)
- Are you planning to attend the GenAI Unplugged event? (Multiple choice: Yes, No, Maybe)
- Mark required fields as needed.
- Click Send → Copy link to get the form URL for testing submissions.
Step 3: Enable Webhook Integration via Google Apps Script
Since Google Forms don’t support webhooks natively, you will use Google Apps Script to send form responses to the n8n webhook URL.
How to add Google Apps Script to your form:
- In your Google Form editor, click the three-dot menu (⋮) near your profile icon.
- Select Script editor or Apps Script.
- Delete any existing code in the editor.
- Paste the following Apps Script code, replacing
WEBHOOK_URLwith your n8n webhook Test URL:
const WEBHOOK_URL = 'https://your-n8n-instance.com/webhook/test-webhook-url';
function onFormSubmit(e) {
const formResponse = e.response;
const itemResponses = formResponse.getItemResponses();
let data = {};
itemResponses.forEach(function(itemResponse) {
const question = itemResponse.getItem().getTitle();
const answer = itemResponse.getResponse();
data[question] = answer;
});
const options = {
method: 'post',
contentType: 'application/json',
payload: JSON.stringify(data),
};
UrlFetchApp.fetch(WEBHOOK_URL, options);
}
Explanation:
- The script listens for form submissions (
onFormSubmit). - It collects question titles and answers into a JSON object.
- It sends this data via HTTP POST to your n8n webhook URL.
Save and deploy the script:
- Rename the project (e.g.,
User Registration Form). - Click Deploy → New deployment.
- Choose Select type → Web app.
- Set:
- Execute as: Me (your account)
- Who has access: Only myself (or anyone, depending on your use case)
- Click Deploy and authorize the required permissions:
- View and manage your forms
- Connect to external services
- Close the deployment dialog.
Step 4: Set Up the Form Submit Trigger in Apps Script
To ensure the script runs on every form submission:
- In the Apps Script editor, click the clock icon (Triggers) on the left sidebar.
- Click Add Trigger.
- Configure:
- Choose function:
onFormSubmit - Deployment:
Head - Event source:
From form - Event type:
On form submit
- Choose function:
- Save the trigger.
- Confirm any authorization prompts and allow access.
Step 5: Test the Integration
- Ensure your n8n webhook node is listening (
Execute Node→Listen for Incoming Requests). - Open your Google Form URL in a browser.
- Submit a test response.
- Return to n8n and check the execution data:
- The webhook node should have captured the form response JSON.
- You can view each field and value as received.
If you want to clean up duplicate entries or ensure unique data before further processing, consider using the Remove Duplicates node as described in the official n8n Merge node documentation.
Step 6: Build Conditional Logic in n8n
Now that your webhook receives data, you can build logic to act on it.
Add an IF node to route based on the "Are you planning to attend" answer:
- Add an
IFnode and connect it to the Webhook node. - Configure the condition:
- Value 1: Expression →
{{$json["Are you planning to attend the GenAI Unplugged event?"]}} - Operation: Equals
- Value 2:
Yes
- Value 1: Expression →
- Connect the
Truebranch to a Slack node. - Connect the
Falsebranch to an Email node.
Slack node setup (for attendees):
- Use the Slack node with the Send Message operation.
- Select your Slack credentials.
- Choose the Slack channel (e.g.,
#events-team). - Set a message like:
New event registration:
Name: {{$json["Name"]}}
Email: {{$json["Email"]}}
Email node setup (for non-attendees):
- Use an Email node (e.g., Amazon SES or SMTP).
- Configure to send an email to your admin team.
- Example email body:
New user registration (non-event):
Name: {{$json["Name"]}}
Email: {{$json["Email"]}}
Interested in attending event: {{$json["Are you planning to attend the GenAI Unplugged event?"]}}
For more advanced data aggregation before sending notifications, you might want to explore the Aggregate Node in n8n to summarize or group responses.
Troubleshooting & Common Mistakes
Webhook not receiving data:
- Ensure the webhook node is actively listening during tests.
- Verify the webhook URL in Apps Script matches the n8n webhook node’s test URL.
- Confirm Apps Script trigger is properly set to run on form submit.
Authorization errors in Apps Script:
- Grant all required permissions during deployment.
- If the app is unverified, click Advanced → Go to project to proceed.
Data fields not matching:
- Double-check the question titles in your form match exactly the keys used in the script and n8n expressions.
- Use the n8n execution preview to inspect received JSON structure.
Emails or Slack messages not sent:
- Verify your Slack credentials and channel permissions.
- Check email node configuration and SMTP or SES credentials.
- Test sending messages/emails independently to isolate issues.
Useful n8n Documentation Links
Quick Reference: Google Forms to n8n Webhook Setup Cheat Sheet
| Step | Action | Notes |
|---|---|---|
| 1. Add Webhook node | Set HTTP method to POST | Use test URL during setup |
| 2. Create Google Form | Add fields: Name, Email, Event Attendance | Keep question titles consistent |
| 3. Add Apps Script code | Paste script with your webhook URL | Deploy and authorize permissions |
| 4. Setup Apps Script Trigger | Trigger on form submit | Ensure trigger is active |
| 5. Test form submission | Submit a form response | Webhook node should capture data |
| 6. Add IF node in n8n | Condition on event attendance | Route to Slack or Email nodes |
| 7. Configure Slack & Email | Send messages/emails accordingly | Use expressions to include form data |
By following these steps, you can seamlessly integrate Google Forms submissions into your n8n workflows using webhooks, enabling automated real-time processing and notifications. This setup serves as a foundation for building more complex and optimized business workflows.