DEV Community

WEDGE Method Dev
WEDGE Method Dev

Posted on

Building a Real-Time Competitive Intelligence System with Claude and Perplexity APIs

One of the most valuable automations I've built for clients: a system that monitors competitors and surfaces actionable insights automatically.

What It Does

Every morning at 7 AM, the system:

  1. Checks competitor websites for changes (pricing, features, messaging)
  2. Monitors social media mentions and sentiment
  3. Scans news for industry developments
  4. Synthesizes everything into a 2-minute briefing

Core Architecture

import anthropic
import requests
from datetime import datetime

client = anthropic.Anthropic()

class CompetitiveIntel:
    def __init__(self, competitors: list[str], industry: str):
        self.competitors = competitors
        self.industry = industry

    def gather_intelligence(self) -> dict:
        """Gather fresh competitive data from multiple sources."""
        intel = {}
        for competitor in self.competitors:
            # Real-time web research
            research = self._research_competitor(competitor)
            # Analyze and structure
            analysis = self._analyze(competitor, research)
            intel[competitor] = analysis
        return intel

    def _research_competitor(self, name: str) -> str:
        """Use Perplexity for real-time research."""
        resp = requests.post(
            "https://api.perplexity.ai/chat/completions",
            headers={"Authorization": f"Bearer {PERPLEXITY_KEY}"},
            json={
                "model": "sonar-pro",
                "messages": [{
                    "role": "user",
                    "content": f"Latest news, product updates, pricing "
                               f"changes, and social media activity for "
                               f"{name} in the last 7 days. Include sources."
                }]
            }
        )
        return resp.json()["choices"][0]["message"]["content"]

    def _analyze(self, name: str, research: str) -> dict:
        """AI-powered analysis of competitive data."""
        response = client.messages.create(
            model="claude-sonnet-4-20250514",
            max_tokens=2048,
            messages=[{
                "role": "user",
                "content": f"""Analyze this competitive intelligence for {name}:

{research}

Return JSON:
- key_changes: list of significant changes this week
- pricing_updates: any pricing changes detected
- new_features: new product features or announcements
- sentiment: overall market sentiment (positive/negative/neutral)
- threats: potential competitive threats to flag
- opportunities: gaps or weaknesses we could exploit
- recommended_actions: specific things to do in response"""
            }]
        )
        return response

    def generate_briefing(self, intel: dict) -> str:
        """Generate executive briefing from all intelligence."""
        briefing = client.messages.create(
            model="claude-sonnet-4-20250514",
            max_tokens=2048,
            messages=[{
                "role": "user",
                "content": f"""Create a 2-minute executive briefing from 
this competitive intelligence:

{intel}

Format:
## Top 3 Things to Know Today
## Competitor Movements
## Opportunities to Act On
## This Week's Priority

Keep it actionable. No fluff."""
            }]
        )
        return briefing
Enter fullscreen mode Exit fullscreen mode

The Scheduling Layer

import schedule
import smtplib
from email.mime.text import MIMEText

def daily_intel_run():
    ci = CompetitiveIntel(
        competitors=["Competitor A", "Competitor B", "Competitor C"],
        industry="AI Consulting"
    )
    intel = ci.gather_intelligence()
    briefing = ci.generate_briefing(intel)

    # Email the briefing
    send_email(
        to="team@company.com",
        subject=f"Competitive Intel Brief - {datetime.now().strftime('%b %d')}",
        body=briefing
    )

# Run daily at 7 AM
schedule.every().day.at("07:00").do(daily_intel_run)
Enter fullscreen mode Exit fullscreen mode

Real Results

For a SaaS client monitoring 5 competitors:

  • Caught a competitor's price drop 3 days before their announcement
  • Identified a feature gap that became their highest-converting landing page
  • Detected negative sentiment around a competitor's product change — we targeted their users with comparison content

Time saved: 5+ hours/week of manual monitoring
Revenue impact: Attributed $120K in new business to competitive insights in Q1

Lessons Learned

  1. Perplexity > scraping for most competitive intelligence. It aggregates sources and handles the messy parts.
  2. Claude excels at synthesis — turning 10 pages of raw research into 3 actionable bullets.
  3. Daily > weekly briefings. Competitive landscapes shift fast in AI.
  4. Always include "recommended actions" — intelligence without action is just noise.

This is one of 30 automation blueprints in my playbook, each with complete code and implementation guide: wedgemethod.gumroad.com/l/ai-automation-playbook-smb


What competitive intelligence tools are you using? I'm always looking for new data sources.

Top comments (0)