feat(api): scope broadcasts and sequences public APIs to workspace tokens - #1133
Open
realcodesiman wants to merge 1 commit into
Open
feat(api): scope broadcasts and sequences public APIs to workspace tokens#1133realcodesiman wants to merge 1 commit into
realcodesiman wants to merge 1 commit into
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
broadcastsworkspace-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 sameBroadcastServicemethods (invariant Automated responses #9).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.resendWithPruningonBroadcastServiceso 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— newcreate,update,updateDraft,schedule,moveToDraft,stop,resume,resend,delete,listContactspublic routes.apps/builder/src/features/broadcasts/schema/public.ts— new request/response schemas forlistContacts.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 newresendWithPruningmethod.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 lintpnpm --filter builder check-typespnpm --filter @chatbotx.io/business check-typespnpm --filter builder test -- broadcasts sequences(3377 passed)pnpm --filter @chatbotx.io/business test -- broadcast(2150 passed)🤖 Generated with Claude Code