Opening Problem Statement
Meet Sarah, a digital marketer who spends countless hours each week manually researching SEO keywords for her clients’ websites. She types queries into Google, analyzes autocompleted suggestions, cleans and formats them, and finally aggregates these keywords into lists ready for content optimization. This process is tedious, prone to human error, and consumes hours of her valuable time—often delaying campaign launches and decreasing productivity.
Sarah’s challenge is specific: how to reliably automate the extraction and aggregation of SEO keywords from Google’s autocomplete suggestions, streamlining the data into clean, actionable keyword lists. Without automation, Sarah risks frequent mistakes, duplicated results, and wasted hours repeating tedious steps.
What This Automation Does
This n8n workflow transforms the SEO keyword research process by automating every key step — from receiving keyword queries via webhook through to outputting well-structured keyword lists. Here’s what happens when you run this workflow:
- It listens for keyword queries sent to a webhook URL, making it easy to trigger remotely or integrate with other tools.
- It automatically calls the Google Autocomplete API to fetch keyword suggestions related to your input query.
- It parses and formats the XML response into a JSON structure that n8n can work with.
- It splits out each individual keyword suggestion for cleaning and further processing.
- It aggregates the cleaned keywords into an organized array, ready to be used for SEO content or saved to files/databases.
- Finally, it responds with the full list of aggregated keywords back to the webhook caller for immediate use or downstream automation.
Overall, this workflow can save marketers like Sarah hours every week, improve accuracy by eliminating manual copying errors, and enable faster SEO campaign rollouts.
Prerequisites ⚙️
- n8n account (cloud or self-hosted) to build and run the workflow.
- Basic understanding of webhook URLs and how to send HTTP requests.
- Internet access to connect with Google’s autocomplete API via HTTP Request node.
- Optional: If self-hosting, consider platforms like Hostinger for reliable server hosting.
Step-by-Step Guide
Step 1: Create the Webhook to Receive Keyword Queries
Navigate to the n8n editor, then click + Add Node → Trigger → Webhook. Name this node Receive Keyword.
Set the webhook path to a unique string, e.g., 76a63718-b3cb-4141-bc55-efa614d13f1d. This webhook will listen for the incoming HTTP GET requests containing the keyword query in the URL parameter q.
Once saved and activated, n8n will provide the full webhook URL, such as http://localhost:5678/webhook/76a63718-b3cb-4141-bc55-efa614d13f1d. Test it by opening your browser and appending ?q=your+keyword to see if it’s reachable.
Common mistake: Forgetting to activate the webhook will cause failed triggers.
Step 2: Autogenerate Google Keyword Suggestions via HTTP Request Node
Add an HTTP Request node after the webhook. Name it Autogenerate Keywords.
Configure it as follows:
- Method: GET (default)
- URL: Use an expression to dynamically pass the query parameter:
=https://google.com/complete/search?output=toolbar&gl=US&q={{ $json.query.q }}
This calls Google’s autocomplete API and requests keyword suggestions for the input query received from the webhook.
Expected outcome: You receive an XML response containing keyword suggestions.
Step 3: Format XML Response into JSON for Parsing
Insert an XML node named Format Keywords connected to the HTTP Request node.
Configure the XML node to parse the raw XML data received from Google into JSON format, enabling subsequent nodes to easily manipulate keyword suggestions.
Step 4: Split Out Keyword Suggestions
Add a Split Out node called Split Out after the XML node.
For fieldToSplitOut, input toplevel.CompleteSuggestion, which corresponds to the array of keyword suggestions in the JSON.
Splitting out lets n8n process each keyword suggestion individually in the next step.
Step 5: Clean and Extract the Keyword Text
Add a Set node named Clean Keywords connected after the Split Out node.
Here, assign a new field Keywords with the cleaned array of keyword suggestions from {{ $json.suggestion.data }}.
This helps standardize the keyword format for aggregation.
Step 6: Aggregate All Clean Keywords into an Array
Add an Aggregate node named Aggregate after the Set node.
Set it to aggregate all values in the Keywords field into one array. This creates a concise final list for output.
Step 7: Respond Back with the Complete Keyword List
Finally, connect the Aggregate node to a Respond to Webhook node named return Keywords.
Configure it to respond with all incoming items, sending the full aggregated list of keywords back to whoever called the webhook.
Step 8: Add Informational Sticky Notes for Reference
Optionally, add Sticky Note nodes to describe the workflow purpose and provide test instructions for future users or collaborators.
Customizations ✏️
- Change Geographic Location: In the HTTP Request node, modify the
gl=USparameter in the URL to a different country code likegl=GBfor UK-specific keyword suggestions. - Expand API Query Parameters: Add other Google autocomplete parameters such as
hl=ento specify language orclient=firefoxfor customized results. - Save Keywords to External Storage: Add nodes like Google Sheets or Airtable after the aggregation to store keyword data for future analytics.
- Use Keywords in Downstream Workflows: Instead of responding with keywords, trigger email or Slack notifications containing top keywords by integrating Gmail or Slack nodes.
- Enhance Keyword Cleaning: Add additional Set or Function nodes after the Split Out node to remove duplicates, trim whitespace, or filter based on keyword length.
Troubleshooting 🔧
Problem: “Webhook did not receive any requests.”
Cause: The webhook is inactive or incorrect URL is being used.
Solution: Make sure the webhook node is activated and test the exact URL with the ?q=keyword parameter.
Problem: “HTTP Request returned empty or malformed XML data.”
Cause: Google API endpoint may have changed or input query is empty.
Solution: Verify the URL expression and ensure the input query is passed correctly from the webhook node.
Problem: “Aggregate node fails to collect keywords properly.”
Cause: Incorrect field reference or missing data in previous nodes.
Solution: Check field names in the Set node and verify data flow using n8n’s execution logs.
Pre-Production Checklist ✅
- Test the webhook URL with different keyword queries.
- Verify the HTTP Request node returns valid XML data.
- Ensure the XML node converts the response correctly to JSON format.
- Check that the Split Out node properly breaks the keyword list into items.
- Confirm the final response node returns the full aggregated keyword list.
- Backup the workflow JSON for rollback.
Deployment Guide
Activate the webhook node first to enable triggering. Monitor workflow executions from the n8n dashboard. Use n8n’s built-in execution logs and error reporting for debugging. Schedule regular tests if used in production environments to ensure API stability.
FAQs
Can I replace Google with another autocomplete service?
Yes, by modifying the HTTP Request node URL and adapting the response parsing in the XML/Set nodes.
Is there any cost for using Google’s autocomplete API?
Google’s autocomplete service is generally free but subject to usage limits and potential blocking for high-frequency calls.
How secure is the webhook URL?
The webhook is open and can be secured by adding authentication or IP whitelisting in n8n or a proxy server.
Conclusion
By building this n8n workflow, you automated the cumbersome SEO keyword research steps Sarah struggled with. You now have a reliable, scalable process that transforms simple keyword inputs into rich, aggregated keyword lists pulled directly from Google’s autocomplete suggestions. Expect to save multiple hours per week and reduce manual errors significantly.
Next, consider extending this automation by storing keywords in external databases, triggering SEO content creation workflows, or integrating with marketing platforms for seamless campaign execution. With n8n, your SEO research just got smarter and way faster.