Automate SEO-optimized content creation with AI-powered keyword research, competitive analysis, and structured article generation. Streamline content production from keyword discovery to publish-ready articles.

Features

  • Keyword Research Integration: DataForSEO API for volume, CPC, and competition metrics
  • Competitive Analysis: Automated content scraping and gap analysis
  • Topic Generation: AI-powered topic suggestions based on keyword data
  • Content Creation: Full article generation with SEO optimization
  • Real-time Processing: Live streaming of content generation progress

Architecture Overview

The content generation process follows a four-stage pipeline:
Business Analysis → Keyword Research → Topic Generation → Article Creation

Processing Pipeline

Stage 1: Business Context Analysis

Analyze the target website to understand business focus, audience, and content style.

Stage 2: Keyword Research

Research and validate keywords using DataForSEO API for search volume and competition data.

Stage 3: Topic Development

Generate SEO-optimized topic suggestions based on keyword opportunities and competitive gaps.

Stage 4: Article Generation

Create comprehensive articles with proper SEO structure, internal linking, and calls-to-action.

Implementation

Business Summary Generation

def generate_business_summary(website_url):
    # 1. Validate URL accessibility
    url_checker = URLCheckerService()
    if not url_checker.is_reachable(website_url):
        raise URLNotAccessibleError(website_url)
    
    # 2. Extract website content
    scraped_content = scrape_url_content(website_url)
    
    # 3. Initialize LLM for analysis
    llm = initialize_llm(model="gpt-4")
    
    # 4. Generate business summary
    prompts = create_business_analysis_prompts()
    chain = create_analysis_chain(llm, prompts)
    
    summary = chain.run(scraped_content)
    return summary

Keyword Research Workflow

def research_keywords(domain, seed_keywords):
    # 1. Initialize DataForSEO client
    dataforseo_client = DataForSEOClient()
    
    # 2. Get keyword suggestions
    keyword_suggestions = dataforseo_client.get_keyword_ideas(
        keywords=seed_keywords,
        location="United States",
        language="en"
    )
    
    # 3. Analyze keyword metrics
    keyword_data = []
    for keyword in keyword_suggestions:
        metrics = dataforseo_client.get_keyword_metrics(keyword)
        keyword_data.append({
            'keyword': keyword,
            'search_volume': metrics['search_volume'],
            'competition': metrics['competition_level'],
            'cpc': metrics['cost_per_click'],
            'difficulty': metrics['keyword_difficulty']
        })
    
    return sorted(keyword_data, key=lambda x: x['search_volume'], reverse=True)

Article Generation Process

def generate_seo_article(topic, keywords, business_context):
    # 1. Research competitor content
    competitor_articles = fetch_competitor_content(keywords)
    
    # 2. Initialize content generation chain
    llm = initialize_llm(model="gpt-4")
    memory = initialize_memory()
    
    # 3. Create article generation prompts
    prompts = create_article_prompts(
        topic=topic,
        target_keywords=keywords,
        business_context=business_context,
        competitor_insights=competitor_articles
    )
    
    # 4. Generate article sections
    article_chain = create_content_chain(llm, prompts, memory)
    
    # Stream article generation
    for section in article_chain.stream():
        yield section
    
    return article_chain.get_final_output()

API Reference

Business Summary Endpoint

POST /pro-agent/business-summary
Request Body
{
  "websiteUrl": "https://example.com",
  "analysisDepth": "comprehensive",
  "focusAreas": ["products", "target_audience", "brand_voice"]
}
Response Format
{
  "summary": {
    "businessType": "E-commerce Platform",
    "targetAudience": "Small to medium businesses",
    "keyProducts": ["Inventory Management", "Point of Sale"],
    "brandVoice": "Professional, approachable, solution-focused",
    "contentThemes": ["efficiency", "growth", "automation"]
  },
  "metadata": {
    "processingTime": "8s",
    "pagesAnalyzed": 5,
    "contentLength": 12500
  }
}

Keyword Research Endpoint

GET /pro-agent/keyword-research
Query Parameters
  • domain: Target domain for research
  • seedKeywords: Comma-separated list of seed keywords
  • location: Geographic location for search data
  • limit: Maximum number of keywords to return
Response Format
{
  "keywords": [
    {
      "keyword": "inventory management software",
      "searchVolume": 8100,
      "competition": "medium",
      "cpc": 12.45,
      "difficulty": 65,
      "trend": "stable",
      "relatedKeywords": [
        "warehouse management system",
        "stock control software"
      ]
    }
  ],
  "totalKeywords": 150,
  "processingTime": "12s"
}

Topic Generation Endpoint

POST /pro-agent/topic-generation
Request Body
{
  "primaryKeyword": "inventory management software",
  "secondaryKeywords": ["warehouse management", "stock control"],
  "businessContext": "B2B SaaS platform targeting SMEs",
  "contentType": "informational",
  "targetLength": "long-form"
}
Response Format
{
  "topics": [
    {
      "title": "Complete Guide to Inventory Management Software for Small Businesses",
      "angle": "Comprehensive educational guide",
      "targetKeywords": ["inventory management software", "small business"],
      "estimatedDifficulty": "medium",
      "contentOutline": [
        "What is Inventory Management Software?",
        "Key Features to Look For",
        "Implementation Best Practices",
        "ROI and Cost Analysis"
      ]
    }
  ],
  "competitorGaps": [
    "Lack of SME-specific implementation guides",
    "Limited cost comparison content"
  ]
}

Article Generation Endpoint

POST /pro-agent/article-generation
Request Body
{
  "topic": {
    "title": "Complete Guide to Inventory Management Software",
    "targetKeywords": ["inventory management", "warehouse software"],
    "contentType": "guide"
  },
  "requirements": {
    "wordCount": 2500,
    "includeImages": true,
    "internalLinks": 3,
    "callsToAction": 2
  },
  "businessContext": {
    "companyName": "StockWise",
    "products": ["Inventory Pro", "Warehouse Manager"],
    "targetAudience": "SME operations managers"
  }
}
Response Format (Streaming)
data: {"type": "section", "title": "Introduction", "content": "Effective inventory management..."}
data: {"type": "section", "title": "Key Features", "content": "Modern inventory systems..."}
data: {"type": "meta", "wordCount": 2487, "readabilityScore": 68}
data: {"type": "complete", "articleId": "art_12345"}

Core Components

ComponentPurpose
URLCheckerServiceWebsite accessibility validation
DataForSEO ClientKeyword metrics and search data
Content ScraperCompetitor content extraction
LLM ChainContent generation and optimization
Topic ValidatorTopic uniqueness and SEO potential
Article FormatterSEO structure and formatting

Configuration

Keyword Research Settings

{
  "dataforseo": {
    "apiKey": "your-dataforseo-key",
    "location": "2840",
    "language": "en",
    "maxKeywords": 1000,
    "includeRelated": true
  },
  "filtering": {
    "minSearchVolume": 100,
    "maxDifficulty": 80,
    "excludeQuestions": false
  }
}

Content Generation Parameters

{
  "generation": {
    "model": "gpt-4",
    "maxTokens": 4000,
    "temperature": 0.7,
    "structure": {
      "introduction": 150,
      "mainSections": 4,
      "wordsPerSection": 400,
      "conclusion": 100
    }
  },
  "seo": {
    "keywordDensity": 1.5,
    "headingStructure": "h1-h2-h3",
    "metaDescriptionLength": 155,
    "internalLinks": 3
  }
}

Usage Examples

Complete Article Generation Workflow

# 1. Generate business summary
curl -X POST /pro-agent/business-summary \
  -H "Content-Type: application/json" \
  -d '{"websiteUrl": "https://stockwise.com"}'

# 2. Research keywords
curl -X GET "/pro-agent/keyword-research?domain=stockwise.com&seedKeywords=inventory,warehouse"

# 3. Generate topic
curl -X POST /pro-agent/topic-generation \
  -H "Content-Type: application/json" \
  -d '{
    "primaryKeyword": "inventory management software",
    "businessContext": "B2B SaaS for SMEs"
  }'

# 4. Create article
curl -X POST /pro-agent/article-generation \
  -H "Content-Type: application/json" \
  -d '{
    "topic": {
      "title": "Complete Inventory Management Guide",
      "targetKeywords": ["inventory software", "warehouse management"]
    }
  }'

Python Integration

import requests

class SEOArticleGenerator:
    def __init__(self, api_key):
        self.api_key = api_key
        self.base_url = "https://api.example.com"
    
    def generate_article(self, website_url, target_keyword):
        # 1. Business analysis
        business_data = self.analyze_business(website_url)
        
        # 2. Keyword research
        keywords = self.research_keywords(website_url, target_keyword)
        
        # 3. Topic generation
        topic = self.generate_topic(keywords[0], business_data)
        
        # 4. Article creation
        article = self.create_article(topic, keywords, business_data)
        
        return article
    
    def analyze_business(self, url):
        response = requests.post(f"{self.base_url}/pro-agent/business-summary", 
                               json={"websiteUrl": url})
        return response.json()
    
    def research_keywords(self, domain, seed_keyword):
        response = requests.get(f"{self.base_url}/pro-agent/keyword-research",
                              params={"domain": domain, "seedKeywords": seed_keyword})
        return response.json()["keywords"]

# Usage
generator = SEOArticleGenerator("your-api-key")
article = generator.generate_article("https://example.com", "inventory software")

Performance & Limits

Processing Metrics

  • Business Analysis: 5-15 seconds per website
  • Keyword Research: 10-30 seconds for 100 keywords
  • Topic Generation: 3-8 seconds per topic
  • Article Creation: 45-90 seconds for 2000-word articles

Rate Limits

  • API Requests: 100 requests per hour per API key
  • DataForSEO Calls: Limited by DataForSEO subscription
  • Content Generation: 20 articles per day per account

Content Specifications

  • Article Length: 500-5000 words
  • Keyword Density: 1-3% for target keywords
  • Reading Level: Flesch score 60-80 (accessible)
  • SEO Structure: H1, H2, H3 hierarchy with keyword optimization

Error Handling

Common Error Responses

Status CodeError TypeDescriptionSolution
400INVALID_WEBSITE_URLWebsite URL inaccessible or invalidVerify URL format and website accessibility
429KEYWORD_QUOTA_EXCEEDEDDataForSEO API limit reachedUpgrade DataForSEO plan or wait for reset
422INSUFFICIENT_CONTENTWebsite lacks adequate content for analysisProvide alternative content sources
500GENERATION_FAILEDArticle generation pipeline errorRetry with simplified requirements

Error Response Format

{
  "error": {
    "code": "KEYWORD_QUOTA_EXCEEDED",
    "message": "DataForSEO API quota exceeded",
    "details": {
      "quotaUsed": 950,
      "quotaLimit": 1000,
      "resetDate": "2024-02-01T00:00:00Z"
    }
  }
}

Integration Guide

Authentication

All requests require API key authentication:
curl -H "Authorization: Bearer your-api-key"

Webhook Configuration

Configure webhooks for content completion:
{
  "webhookUrl": "https://your-app.com/content-ready",
  "events": ["article.completed", "keyword.research.completed"]
}

Content Quality Controls

Generated articles include:
  • SEO Optimization: Proper keyword placement and density
  • Readability: Target Flesch score of 60-80
  • Structure: Logical H1-H6 heading hierarchy
  • Internal Linking: Strategic links to related content
  • Meta Elements: Optimized title tags and descriptions
  • Content Guidelines: Brand voice and style consistency