Skip to content

feat(api): scope broadcasts and sequences public APIs to workspace tokens - #1133

Open
realcodesiman wants to merge 1 commit into
mainfrom
realcodesiman/feat-broadcasts-scope-public-apis
Open

feat(api): scope broadcasts and sequences public APIs to workspace tokens#1133
realcodesiman wants to merge 1 commit into
mainfrom
realcodesiman/feat-broadcasts-scope-public-apis

Conversation

@realcodesiman

Copy link
Copy Markdown
Contributor

Summary

  • Adds full public API coverage for broadcasts under the broadcasts workspace-token scope: create, rename, replace-draft, schedule, move-to-draft, stop, resume, resend, delete, and list recipients by event type — mirroring every private builder action so both paths call the same BroadcastService methods (invariant Automated responses #9).
  • Extends the sequences public API with equivalent scope-gated routes.
  • Adds audit logging (launch, broadcast_moved_to_draft, broadcast_stopped, broadcast_resumed, delete) for broadcast lifecycle transitions that previously happened silently, both from the UI actions and the new public routes.
  • Introduces resendWithPruning on BroadcastService so the public resend route applies the same email/phone contact-filter pruning the private action already did, without duplicating the guard logic.

Changes

  • apps/builder/src/features/broadcasts/api/public.ts — new create, update, updateDraft, schedule, moveToDraft, stop, resume, resend, delete, listContacts public routes.
  • apps/builder/src/features/broadcasts/schema/public.ts — new request/response schemas for listContacts.
  • apps/builder/src/features/broadcasts/schema/action.ts — shared schema additions reused by both private actions and public routes.
  • apps/builder/src/features/broadcasts/actions/*.action.ts — refactored to delegate through the shared service methods used by the public API.
  • apps/builder/src/features/sequences/api/public.ts — new public routes for sequences.
  • packages/business/src/broadcast/service.ts — added audit calls on lifecycle transitions and the new resendWithPruning method.
  • Test coverage: apps/builder/__tests__/broadcasts-public-api.test.ts, sequences-public-api.test.ts, sequences-public-scope.test.ts, plus updates to existing broadcast action/service tests.

Test plan

  • pnpm lint
  • pnpm --filter builder check-types
  • pnpm --filter @chatbotx.io/business check-types
  • pnpm --filter builder test -- broadcasts sequences (3377 passed)
  • pnpm --filter @chatbotx.io/business test -- broadcast (2150 passed)

🤖 Generated with Claude Code

…kens

Adds full CRUD/lifecycle public API routes for broadcasts (create,
update, draft replace, schedule, move-to-draft, stop, resume, resend,
delete, list contacts) and extends the sequences public API, mirroring
the private builder actions so both paths share one service method per
invariant #9. Also adds audit logging for broadcast lifecycle
transitions that were previously silent.

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