Skip to content

feat(ads): real Meta Ads draft creator via MCP #27

@wesleysimplicio

Description

@wesleysimplicio

Context

AGENTS.md stack table: Meta Ads (MCP active, META_ADS_MCP_ACTIVE=true). .ralph/PROMPT-promotion.md § 3 specifies the draft payload shape. No code exists.

Goal

A lib/publish/meta-ads.ts module that takes a winner piece + persona + creative IDs and creates a paused Meta Ads campaign draft.

Acceptance criteria

  • Reads META_ADS_MCP_ACTIVE from env; throws clearly if false
  • draftCampaign(piece, persona, creativeIds) returns the campaign payload
  • Default objective OUTCOME_ENGAGEMENT (overridable via piece frontmatter)
  • Audience hint derived from .specs/clients/<client>/PERSONAS.md (persona by piece's persona_id)
  • Budget placeholder, paused state, ad-set + ad creative attached to existing creative IDs
  • When DRY_RUN=true: writes outputs/<client>/<date>/<piece-id>/ads-draft.json (per PROMPT-promotion.md § 3)
  • When DRY_RUN=false: calls the Meta Ads MCP (mcp__*__ads_create_campaign + ads_create_ad_set + ads_create_creative + ads_create_ad) — all paused
  • Logs to data/promotions.jsonl (per DESIGN.md § Data Flow)
  • Idempotent per (piece, date): refuses to overwrite, suffixes instead
  • E2E spec with mocked MCP transport

Files

  • New: lib/publish/meta-ads.ts
  • data/promotions.jsonl (writer)

Depends on

  • #classifier (consumer)
  • #pieces-engine (frontmatter provider_override.ads)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions