1. Opening Problem Statement
Meet Mark, a digital marketer at a growing content agency. Every week, Mark faces the daunting task of generating comprehensive SEO keyword research for multiple content briefs. This involves manually gathering primary keywords, long-tail variations, keyword difficulty, search volume, and competitor insights. The process consumes over 4 hours per project, increasing the risk of errors and missed opportunities, which translates into lower content performance and wasted budget.
Mark’s challenge is that this research needs to be specific: tailored to target audience, location, language, and content type. Plus, competitor research is critical but time-consuming. He needs a reliable, automated way to get high-quality SEO keyword strategies fast and consistently.
2. What This Automation Does
This unique n8n workflow integrates AI (OpenAI’s language models through LangChain) and SEO data providers (DataForSEO) to fully automate the SEO keyword research pipeline. When triggered, it:
- Expands a primary SEO topic into rich keyword sets: primary keywords, long-tail keywords with intent, question-based keywords, and related topics.
- Fetches current search volume and cost-per-click data for these keywords based on specific language and location filtering.
- Retrieves keyword difficulty scores to prioritize feasible ranking opportunities.
- Performs competitor analysis by processing URLs to identify their primary keywords, content gaps, and unique angles.
- Synthesizes all data into a human-readable, actionable SEO content brief using advanced AI summarization.
- Updates the research status in NocoDB and sends Slack notifications to keep the team informed about progress.
By automating these details, it saves Mark up to 3-4 hours per keyword research cycle and reduces friction and errors with consistent structured output.
3. Prerequisites ⚙️
- n8n account (self-hosted optional via services like Hostinger)
- OpenAI account with API access 🔐
- DataForSEO API account for keyword metrics and analysis 🔑
- NocoDB account to manage input/output records 📁
- Slack workspace & bot setup for notifications 💬
4. Step-by-Step Guide
Step 1: Setup Webhook Trigger for Input from NocoDB
Navigate to Triggers and add a Webhook node named “Get Input from NocoDB”. Set the path as ac7e989d-6e32-4850-83c4-f10421467fb8 and method as POST. This will receive JSON data containing the primary topic, competitor URLs, target audience, content type, location, and language.
Test by posting sample data from NocoDB to ensure the webhook correctly receives input.
Common mistake: Forgetting to set method to POST leads to un-triggered workflows.
Step 2: Use Set Node to Extract Relevant Fields
Add a Set node “Set relevant fields” after the webhook. Assign field values such as primary_topic, competitor_urls, target_audience, content_type, location, and language from the JSON body paths. This prepares data for downstream use.
You should see these mapped fields in the node output.
Tip: Use the expression editor with the exact path from webhook input to avoid mapping errors.
Step 3: Send Slack Notification – Start
Add a Slack node “Start Notification” connected after the Set node to notify the team when the research begins. Configure the Slack channel ID and message including variable placeholders like {{ $json.primary_topic }}.
This provides real-time feedback on workflow activity.
Step 4: Update Status in NocoDB to “Started”
Add NocoDB node “Update Status – Started” to update the input record’s status field from something like “Pending” to “Started”. Use the Id field from input to locate the correct record.
Outcome: database status reflects active processing.
Step 5: Expand Topic Keywords with OpenAI via LangChain Agent
Add LangChain Agent node “Topic Expansion” using the OpenAI Chat Model credentials. The prompt includes variables for topic, audience, content type, location, and language, requesting primary keywords, long-tail keywords with intents, questions, and related topics formatted as JSON.
Check output for structured JSON with 4 arrays: primary_keywords, long_tail_keywords, question_based_keywords, and related_topics.
Common mistake: Incorrect prompt formatting can cause parse errors downstream.
Step 6: Parse AI JSON Output
Use the Structured Output Parser node to validate and parse the AI JSON schema output from “Topic Expansion”. This ensures the data structure is consistent and ready for further processing.
Step 7: Split Primary Keywords for Metrics Lookup
Use SplitOut node to break the primary keywords array into individual keyword items.
Step 8: Fetch Search Volume & Cost per Click
Connect to the DataForSEO node “Search Volume & CPC” using API credentials. Send each keyword with location and language to get current search volume and CPC. Aggregate these later.
Step 9: Get Keyword Difficulty Scores
Similarly, use DataForSEO’s “Keyword Difficulty” endpoint node to retrieve difficulty metrics for keywords.
Step 10: Aggregate SEO Metrics
Use Aggregate nodes “Aggregate SV & CPC” and “Aggregate KWD” to consolidate the multiple outputs into summarized arrays.
Step 11: Merge Keyword Data
Use Merge node “Merge SV, CPC & KWD” to combine search volume, CPC, and keyword difficulty data aligned by keyword position.
Step 12: Format Competitor URLs
Add a Code node “Format Json and add Competitor URLs” that splits competitor URLs string into an array for further processing.
Use this JS snippet:
const inputJson = $input.first().json;
const rawUrls = inputJson.competitor_urls;
const competitorUrls = rawUrls
.split(",")
.map(url => url.trim())
.filter(url => url.length > 0);
const outputJson = {
...inputJson,
competitorUrls: competitorUrls
};
return [{ json: outputJson }];Step 13: Split Competitor URLs for Individual Analysis
Use a SplitOut node “Split the Competitor URLs” to send each URL separately into competitor keyword ranking requests.
Step 14: Get Keyword Rankings per Competitor URL
Call the DataForSEO node “Keyword Ranking per URL” to get top ranked keywords for each competitor’s page filtered by location and language.
Step 15: Competitor Analysis with OpenAI
Use the LangChain agent node “Competitor Analysis” to analyze gathered competitor data and identify target keywords, content gaps, unique angles, and questions addressed.
Step 16: Aggregate Competitor Analysis Results
Use Aggregate node “Aggregate Competitor Analysis” to combine competitor insights into one wrapped JSON.
Step 17: Merge All SEO Data
Use multiple Merge nodes “Merge Topic Expansion, SV, CPC & KWD” and “Merge Everything” to combine keyword research, metrics, and competitor insights into a single JSON payload.
Step 18: Generate Final SEO Strategy and Content Brief
Send the combined data to the LangChain agent “Final Keyword Strategy” with a detailed prompt to synthesize an executive summary, target keywords, competitor analysis, content gaps, and content outline with SEO-optimized recommendations in Markdown.
Step 19: Write Content Brief to NocoDB
Use NocoDB node “Write Content Brief” to create a new record containing the final strategy output for the primary topic.
Step 20: Update Status to Done
Update the original input record’s status in NocoDB to “Done” using the node “Update Status – Done”.
Step 21: Send Slack Notification – Done
Notify the marketing team in Slack with the final project details via the “Send Notification” Slack node.
5. Customizations ✏️
- Change Target Audience: Edit the
Set relevant fieldsnode to update thetarget_audiencefield; all prompts dynamically use this variable. - Add More Competitor URLs: Append URLs in the NocoDB input; workflow splits and fetches data for each competitor automatically.
- Modify AI Models or Parameters: Change the OpenAI model version or parameters in “OpenAI Chat Model” nodes for higher creativity or speed.
- Adjust Keyword Metrics Sources: Swap DataForSEO nodes with alternative API providers if credentials are updated, adjusting node parameters accordingly.
- Change Slack Notification Channel: Update Slack node channelId field to alert different teams or projects.
6. Troubleshooting 🔧
Problem: “Failed to retrieve keyword difficulty data”
Cause: API limits reached or incorrect parameters sent to DataForSEO.
Solution: Verify API keys and limits in DataForSEO account. Check keyword format in split node. Adjust workflow execution frequency.
Problem: “OpenAI API timeout or rejected request”
Cause: Network issues or exceeding OpenAI quota.
Solution: Monitor OpenAI usage. Use retry logic or reduce prompt complexity. Check n8n credentials configuration.
Problem: “Slack notification not sent”
Cause: Invalid Slack webhook or permissions.
Solution: Confirm Slack API token and channel ID. Test sending manual messages from Slack node.
7. Pre-Production Checklist ✅
- Confirm Webhook correctly receives NocoDB inputs
- Validate all API credentials for OpenAI, DataForSEO, Slack, and NocoDB
- Test AI prompt outputs are well-formed JSON to avoid parse errors
- Verify NocoDB status updates occur as expected
- Test Slack notifications for both start and completion of workflow
- Run full test with sample data including competitor URLs
- Backup NocoDB data before workflows change status
8. Deployment Guide
Activate the workflow by ensuring the Webhook node URL is publicly accessible and connected to your NocoDB form or input system.
Set workflow to active in your n8n instance.
Enable monitoring in n8n to check node executions and errors.
Optionally, create dashboards or logs to track keyword research task statuses.
9. FAQs
Q: Can I replace DataForSEO with another SEO API?
A: Yes, but you will need to adjust API calls and data parsing accordingly. Make sure the alternate provider offers keyword difficulty, volume, and ranking data.
Q: Does this workflow consume OpenAI API credits quickly?
A: It depends on volume and prompt complexity. Optimize prompt length and reuse cached results to reduce costs.
Q: Is my data safe?
A: Yes, n8n nodes use encrypted credential storage. Ensure your API keys and tokens are securely managed.
10. Conclusion
By implementing this AI-powered SEO keyword research automation workflow in n8n, Mark has saved countless hours each week while boosting the depth and quality of SEO content briefs. The combination of AI-driven keyword generation, real-time metrics, and competitor insights delivers comprehensive strategies faster and more reliably than manual methods.
You’ve built a dynamic system that not only increases productivity but also improves SEO outcomes by focusing on data-backed keywords with clear intent and competitive advantage. Next, consider automating content creation or integrating backlink analysis to further supercharge your SEO efforts.