Back to guides
6
5 min

Deploy & Connect

Alerts, MCP & Scheduled Reports

From Prototype to Production

A marketing intelligence system on localhost is a demo. A marketing intelligence system that sends Slack alerts when competitors change their messaging, generates weekly performance digests automatically, and exposes its knowledge to other AI tools via MCP — that's a product.

This module covers the four pillars of production deployment: infrastructure, integrations, automation, and observability.

Production Deployment

Environment Management

Production requires careful separation of secrets, configuration, and code:

  • API keys (Anthropic, embedding provider) → environment variables, never committed to git
  • Database URLs → environment-specific (dev/staging/prod), rotatable without redeploy
  • Feature flags → toggles for experimental features (e.g., new guardrail, revised reranking weights)
  • Rate limits → configurable per-team, adjustable without code changes
  • Health Checks

    A /api/health endpoint that verifies:

  • Database connection is alive and responsive
  • Embedding model can generate vectors
  • AI model API is reachable
  • Cache is functioning
  • Response time is within acceptable bounds
  • Health checks enable zero-downtime deployments and automated recovery. The load balancer checks health before routing traffic, and monitoring systems alert when health degrades.

    Error Tracking

    Structured logging with context:

    { level: "error", service: "gateway", node: "brand_check",
      query_intent: "content_draft", error: "Brand compliance below threshold",
      compliance_score: 42, team: "content", timestamp: "..." }

    Structured logs enable powerful debugging. Instead of searching through unstructured text, you can filter: "show me all brand_check errors from the content team in the last 24 hours."

    Slack Integration

    Competitor Change Alerts

    The highest-value integration. A scheduled job runs daily (or more frequently):

  • Fetch current competitor profiles
  • Compare against last-known snapshots
  • If any fields changed (positioning, pricing, features), send a Slack alert
  • The alert format is a rich Slack message:

    :rotating_light: Competitor Change Detected: Acme Corp
    
    Positioning: "The affordable alternative" → "Enterprise-grade at every scale"
    Pricing: Added new Enterprise tier at $25K/year
    Features: Added "AI-powered analytics" to feature list
    
    Last checked: 2 days ago
    Source: competitor_profiles · 2024-11-15
    
    [View Full Brief] [Acknowledge]

    This is the "killer feature" for marketing teams. Instead of manually checking competitor websites, the system watches for them and alerts on changes.

    Slash Command

    A Slack slash command for ad-hoc queries:

    /marketing-intel What content themes drove the most engagement last week?

    The command routes through the full AI Gateway (classify → cache → guardrails → LLM → brand check → format) and returns the response as a Slack message with source citations and confidence indicators.

    Weekly Digest

    A scheduled message (e.g., every Monday at 9am) summarizing:

  • Competitive landscape changes since last digest
  • Top-performing content and campaigns
  • Emerging industry trends
  • Content recommendations for the coming week
  • The digest is generated by running a structured query through the gateway and formatting the response as a rich Slack message with sections, metrics, and action items.

    MCP Server

    The Model Context Protocol (MCP) lets other AI tools use your marketing intelligence as a data source. You build an MCP server that exposes:

    Tools

  • analyze_competitor(name) — returns a competitive brief with positioning, strengths, weaknesses, and recent changes
  • get_trends(topic, time_range) — returns trend analysis with temporal data
  • draft_content(topic, format, audience) — generates brand-compliant content
  • campaign_performance(campaign_id?) — returns campaign metrics and analysis
  • competitive_brief() — returns a full competitive landscape summary
  • Resources

  • Competitor list (names, threat levels, last updated)
  • Campaign catalog (active campaigns with key metrics)
  • Brand guidelines (voice, tone, messaging pillars)
  • Why MCP Matters

    With MCP, a team member using Claude Desktop can ask "How does our positioning compare to CompetitorX?" and Claude will call your analyze_competitor tool, pulling live data from your marketing intelligence system. Your RAG pipeline becomes a data source for any MCP-compatible AI tool.

    This is the difference between a standalone tool and a platform. MCP turns your marketing intelligence into infrastructure that other tools build on.

    Scheduled Reports

    Daily: Competitor Monitoring

    Runs every morning. Checks each competitor profile for changes. If changes are detected, sends Slack alerts. If no changes, logs "no changes detected" (useful for confirming the system is running).

    Weekly: Campaign Performance

    Runs every Monday. Aggregates campaign metrics from the past week. Generates a performance summary with:

  • Top 3 campaigns by ROI
  • Engagement trends across channels
  • Content themes that performed above/below average
  • Recommendations for the coming week
  • Monthly: Competitive Landscape

    Runs on the 1st of each month. Generates a comprehensive report:

  • How each competitor's positioning has shifted
  • Market trend summary from industry reports
  • Share of voice analysis
  • Strategic recommendations
  • Scheduled reports use the same AI Gateway as interactive queries — they benefit from the same caching, guardrails, and brand compliance checks.

    Monitoring & Observability

    Metrics Dashboard

    Track the operational health of the system:

  • Latency — p50, p95, p99 for each gateway node and total
  • Token usage — per team, per day, per query type
  • Cache hit ratio — should be 40-60% for a well-tuned system
  • Error rate — percentage of queries that fail
  • Brand compliance score — average compliance across content drafts
  • Alerts

    Automated notifications when something goes wrong:

  • Error rate exceeds 5% → immediate Slack alert
  • p95 latency exceeds 5 seconds → warning alert
  • Team hits budget limit → budget alert to team lead
  • Brand compliance violation detected → alert to content lead
  • Competitor change detected → alert to strategy team
  • ROI Tracking

    Marketing leadership wants to know: "Is this system worth it?" Track:

  • Time saved per analyst (estimated from query frequency and complexity)
  • Content drafts generated (vs manual drafting time)
  • Competitive insights surfaced (alerts that led to action)
  • Cost per insight (total AI spend / useful outputs)
  • Operations Runbook

    Document the common issues and how to resolve them:

  • Embedding model slow/failing — check model cache, restart container, fall back to mock embeddings
  • Cache miss rate spiking — check if data was recently re-indexed (new embeddings = cache invalidation)
  • Brand compliance scores dropping — review recent brand guideline changes, update the gateway's brand reference
  • Competitor change false positives — adjust change detection thresholds, add ignore patterns for known-noisy fields
  • Budget exhaustion — review usage patterns, adjust per-team allocations, consider caching optimizations
  • What You'll Build

  • Deploy the Marketing Intelligence app to production with health checks and env management
  • Build Slack integration with competitor change alerts and slash commands
  • Create an MCP server with marketing intelligence tools and resources
  • Set up scheduled reports (daily, weekly, monthly)
  • Build monitoring dashboard with latency, usage, and compliance tracking
  • Glossary

    TermMeaning
    MCPModel Context Protocol — a standard for exposing AI tools and resources to other AI systems
    Competitor change detectionComparing current vs previous competitor data to identify and alert on changes
    Scheduled reportAn automated, recurring analysis generated and delivered without user intervention
    Health checkAn endpoint that verifies system components are functioning correctly
    RunbookDocumentation of common issues, their symptoms, and resolution steps
    Cache hit ratioPercentage of queries served from cache vs computed fresh

    This is chapter 6 of AI Marketing Intelligence.

    Get the full hands-on course for $100 and build the complete system. Your projects become your portfolio.

    View course details