AI Competitive Analysis is a 3-stage n8n pipeline, Extract, Analyze, Write, built on OpenAI GPT-4.1, that turns raw competitor data pasted once into a board-ready executive summary delivered to Notion. It replaces a 2-3 hour manual copy-paste research routine with a 90-second automated run costing about $0.10-0.20 in OpenAI usage.
What you will be able to do
- Build a 3-stage n8n pipeline that extracts competitor data into structured JSON, analyzes it with chain-of-thought reasoning, and writes an executive summary.
- Configure OpenAI and Notion credentials in n8n so analysis reports land automatically on a Notion page you share with the integration.
- Switch the workflow between quick mode for a single competitor and deep mode for multi-competitor analysis.
- Diagnose common failures such as invalid JSON output, a missing Notion page, or low quality analysis.
- Swap OpenAI nodes for Anthropic nodes or change models (GPT-4.1-mini, GPT-3.5-turbo) to trade cost against quality.
Before you start
- An n8n instance, self-hosted for free or n8n cloud at $20 a month
- An OpenAI API key from platform.openai.com with billing enabled for GPT-4.1 usage
- A Notion account with an integration token, and the target Notion page shared with that integration
- Comfort importing and running a workflow in n8n; no coding required
Reference
| Pattern | Stage 1 (Extract) | Stage 2 (Analyze) | Stage 3 (Write) |
|---|---|---|---|
| Role Setting | Data extraction specialist | Competitive analyst | Content strategist |
| Temperature | 0.2 (deterministic) | 0.6 (balanced) | 0.7 (creative) |
| Zero/Few-shot | Zero-shot | Few-shot (with example) | - |
| Structured Output | JSON schema | - | Markdown template |
| Chain-of-Thought | - | Step-by-step reasoning | - |
| Self-Critique | - | - | Review checklist |
| RAG/Grounding | Live web data | Stage 1 data | Stage 2 analysis |
| Multi-Stage | Part of 3-stage architecture | Part of 3-stage architecture | Part of 3-stage architecture |
Common errors and fixes
| What goes wrong | The fix |
|---|---|
| Stage 1 produces invalid JSON | Check that input data is clearly structured with labels like Company:, Pricing:, Features:. The quality gate catches this and routes to a warning path |
| Notion page not created | Verify the integration is shared with the target page, check the page ID in the environment variable, and ensure the integration has Insert content permission |
| Analysis quality is low | Provide more detailed competitor data: specific pricing numbers and actual feature names instead of general descriptions |
| OpenAI rate limit errors | Add a Wait node (1-2 seconds) between stages, or upgrade your OpenAI account tier |
Read the full walkthrough
The complete lesson, with screenshots and any downloads, is published on Substack as part of Prompt Engineering for AI Automation.
More in this section
- Lesson 7: Lesson 7: RAG Ground the Model with Your Own Sources
- Lesson 8: From Prompting Patterns to Production Workflows: The Complete Integration Tutorial for ChatGPT and Claude
Continue the course
Browse all lessons in the Prompt Engineering for AI Automation course, or subscribe to the GenAI Unplugged newsletter to get new lessons in your inbox.