Skip to content

feat(api): activate the ads public API scope - #1132

Open
realcodesiman wants to merge 1 commit into
mainfrom
realcodesiman/feat-ads-scope-public-api
Open

feat(api): activate the ads public API scope#1132
realcodesiman wants to merge 1 commit into
mainfrom
realcodesiman/feat-ads-scope-public-api

Conversation

@realcodesiman

Copy link
Copy Markdown
Contributor

Summary

  • The ads workspace-token scope shipped in the enum/registry/i18n from day one but had no endpoints wired to it — a token scoped to ["ads"] reached nothing.
  • Adds public API routes for ads conversion-rule CRUD, CTWA/CTM/CTID funnel and CAPI-delivery reads, conversion export, ad-account reads, and the full messaging-ad campaign lifecycle (create/retry/publish/pause/delete + video upload).
  • Every handler calls the same packages/business service method its private/UI counterpart already calls, per .agents/rules/data-access.md.

Changes

  • apps/builder/src/features/ads/api/public.ts + schema/public.ts — conversion rules, funnel, CAPI delivery, export, ad-account reads
  • apps/builder/src/features/ads-campaign/api/public.ts + schema/public.ts — messaging-ad campaign lifecycle
  • apps/builder/src/routers/public.ts — mounts ads on the public router
  • packages/business/src/ads-conversion/service.ts — adds findOrFail (single-rule read with the standard not-found contract, reused by the new GET /v1/ads/conversion-rules/{id} handler)
  • docs/developer/workspace-api-tokens.md — endpoint-to-scope table and the two invariants specific to this scope (no assertWorkspaceSuperAdmin on the token path; createdBy always null for token-created campaigns)
  • Tests: ads-public-scope.test.ts (router wiring), ads-public-api.test.ts, ads-campaign-public-api.test.ts (handler behavior, including the missing-session-user regression guard), plus ads-conversion-rule.service.test.ts coverage for findOrFail

Test plan

  • pnpm lint
  • pnpm --filter builder check-types
  • pnpm --filter @chatbotx.io/business check-types
  • pnpm --filter builder test (full suite, 3355 passed)
  • pnpm --filter @chatbotx.io/business test (full suite, 2145 passed)

Wire the previously-inert `ads` workspace-token scope to real endpoints:
conversion-rule CRUD, CTWA/CTM/CTID funnel and CAPI-delivery reads,
conversion export, ad-account reads, and the full messaging-ad campaign
lifecycle. Every handler calls the same business-service method its
private/UI counterpart uses.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions github-actions Bot added the feature New feature or request label Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant