Skip to content

07 Integration Guide

John Williams edited this page Mar 16, 2026 · 1 revision

Integration Guide

Ghost Writer integrates with the googleadsagent.ai ecosystem and can be used as a standalone API or as part of a larger content and advertising workflow.


Ecosystem Connections

Advertising Hub (25+ Agents)

Ghost Writer can be invoked by the advertising-hub orchestration layer when content generation is needed:

  • Use case: Generate LinkedIn posts from campaign insights, blog posts from audit findings, or email copy from lead data
  • Flow: Hub receives request → routes to Ghost Writer API → returns formatted content
  • Context: Hub can pass campaign data, audience segments, or topic briefs as context

Google Ads MCP

The google-ads-mcp server provides live Google Ads API access. Ghost Writer can consume:

  • Campaign data — For case studies, performance narratives, proof points
  • Search terms — For topic ideas, FAQ content
  • Audience insights — For persona-aware copy

Example flow: MCP returns top-performing keywords → Ghost Writer generates blog post or LinkedIn post using those topics.

ContextOS (Voice Profiles & Session Memory)

  • Voice profiles — Custom profiles can be stored in ContextOS and loaded by Ghost Writer
  • Session memory — Prior generations, preferences, and feedback can inform future requests
  • Cross-tool consistency — Same voice across Audit Engine reports, Ghost Writer content, and chat

Intel Harvester (Competitor Content)

Intel Harvester collects competitor content from public sources. Ghost Writer can:

  • Use competitor posts as topic inspiration (not copy)
  • Adapt format and structure from high-performing examples
  • Generate differentiated responses to competitor messaging

Google Ads Audit Engine

The 250-point Audit Engine produces structured audit data. Ghost Writer can:

  • Turn audit findings into proof points for case studies
  • Generate client-facing summaries from technical scores
  • Create blog posts or LinkedIn posts that cite audit results

API Endpoints

Base URL: https://googleadsagent.ai/api (or your deployment)

POST /api/writing-agent

Main content generation and adaptation endpoint.

Actions: generate, check, adapt

Generate Request

{
  "action": "generate",
  "type": "linkedin",
  "topic": "Why PMax works better with brand campaigns",
  "context": "B2B SaaS audience, $50K/month spend",
  "voice": "john-williams",
  "length": 500,
  "variants": 1,
  "detectorsEnabled": true
}

Generate Response

{
  "action": "generate",
  "type": "linkedin",
  "voice": "john-williams",
  "topic": "Why PMax works better with brand campaigns",
  "results": {
    "variant": 1,
    "content": "Here's the thing about PMax...",
    "qa": {
      "passed": true,
      "hardFails": 0,
      "softFails": 2,
      "checks": [...]
    },
    "stats": {
      "wordCount": 127,
      "avgSentenceLength": 16.2,
      "sentenceLengthStdev": 7.1,
      "ttr": 0.52,
      ...
    },
    "detection": {
      "gptzero": { "aiProbability": 0.12, "passed": true },
      "pangram": { "prediction": "Human", "passed": true },
      "originality": { "aiScore": 0.08, "plagiarismScore": 0.02, "passed": true },
      "allPassed": true
    },
    "revisionCount": 0,
    "platform": { "name": "LinkedIn", "maxChars": 3000, ... }
  }
}

Check Request (Existing Text)

{
  "action": "check",
  "existingText": "Your existing content to analyze...",
  "type": "linkedin",
  "voice": "john-williams",
  "detectorsEnabled": true
}

Check Response

{
  "action": "check",
  "qa": { "passed": true, "checks": [...], "hardFails": 0, "softFails": 1 },
  "detection": { "gptzero": {...}, "pangram": {...}, "originality": {...} },
  "stats": { "wordCount": 89, ... },
  "platform": {...}
}

Adapt Request (Format Only)

{
  "action": "adapt",
  "existingText": "Your content to format for platform...",
  "type": "linkedin",
  "voice": "john-williams"
}

POST /api/writing-agent-check

Grammar, readability, tone, AI detection, and plagiarism check for arbitrary text.

Request:

{
  "text": "Your content to check...",
  "checkGrammar": true,
  "checkReadability": true,
  "checkTone": true,
  "checkAI": true,
  "checkPlagiarism": true
}

Response:

{
  "grammar": { "errors": [...], "score": 94 },
  "readability": { "fleschKincaid": 65, "grade": "8th grade", "wordCount": 120, ... },
  "tone": { "detected": ["confident", "direct"], "onBrand": true, "suggestions": [] },
  "aiDetection": { "overallScore": 0.15, "passed": true, "sentences": [...] },
  "plagiarism": { "score": 0.02, "matches": [] },
  "style": {
    "phraseBlacklistHits": [],
    "vocabularyRichness": 0.52,
    "hapaxRatio": 0.31,
    "burstiness": 7.2,
    "avgSentenceLength": 16.1
  }
}

POST /api/writing-agent-voice

Voice profile management.

Actions: analyze, save, list, get, delete

Analyze Request

{
  "action": "analyze",
  "samples": [
    "Your first writing sample...",
    "Your second sample...",
    "Your third sample..."
  ]
}

Analyze Response

{
  "action": "analyze",
  "fingerprint": {
    "sentenceLength": { "mean": 16.2, "stdev": 8.5, "min": 3, "max": 42 },
    "vocabulary": { "ttr": 0.51, "domainTerms": [...], "signaturePhrases": [...] },
    "structuralHabits": { "startsWithConjunctions": true, "usesFragments": true, ... },
    "toneAnchors": ["direct", "data-driven", ...],
    "perplexityTarget": [28, 48],
    "burstiTarget": "high",
    "samplesAnalyzed": 3,
    "totalWordsAnalyzed": 1250
  }
}

Save Request

{
  "action": "save",
  "name": "my-custom-voice",
  "samples": ["Sample 1...", "Sample 2...", "Sample 3..."]
}

Requires CONTEXT KV binding.


CORS

All endpoints support CORS with Access-Control-Allow-Origin: * for OPTIONS and POST.

Clone this wiki locally