Skip to content

feat(api): add inbox-scoped public API for conversations, messages, saved replies, and teams - #1131

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

feat(api): add inbox-scoped public API for conversations, messages, saved replies, and teams#1131
realcodesiman wants to merge 1 commit into
mainfrom
realcodesiman/feat-inbox-scope-public-apis

Conversation

@realcodesiman

Copy link
Copy Markdown
Contributor

Summary

  • Adds workspace-token endpoints under the inbox API scope: conversation actions (assign, archive/unarchive, read/unread, follow/unfollow, enable/disable bot), conversation-scoped messages (list/get/create/edit/delete/attributes), saved replies CRUD, and enterprise team CRUD/membership.
  • Every new handler delegates to the same business-layer service method the private UI action already calls, keeping the public and private paths consistent.
  • Fixes conversationService.updateAssignment's bulk WHERE clause, which was missing a workspaceId scope — an oversight that would have made the new public assignment endpoint a cross-tenant write.

Changes

  • apps/builder/src/features/conversations/api/public.ts, schema/public.ts — conversation action endpoints
  • apps/builder/src/features/messages/api/public.ts, schema/public.ts — message CRUD endpoints (new)
  • apps/builder/src/features/saved-replies/api/public.ts — saved reply CRUD endpoints
  • apps/builder/src/enterprise/features/inbox-teams/api/public.ts — team CRUD/membership endpoints
  • apps/builder/src/routers/public.ts — registers the new messages public router
  • packages/business/src/conversation/service.ts — scopes updateAssignment's WHERE by workspaceId
  • packages/business/src/enterprise/inbox-team/service.tscreate now returns the created team
  • packages/business/src/saved-reply/service.ts — adds findByIdOrFail
  • docs/developer/workspace-api-tokens.md — documents the inbox scope endpoint-to-scope table and invariants
  • Test coverage: new __tests__/conversations-public-api.test.ts, conversations-public-scope.test.ts, inbox-teams-public-api.test.ts, messages-public-api.test.ts, saved-replies-public-api.test.ts

Test plan

  • pnpm lint
  • pnpm --filter builder check-types
  • pnpm --filter builder vitest run on the new/changed test files (58 passed)
  • pnpm --filter @chatbotx.io/business test for conversation/saved-reply/inbox-team services (2144 passed)
  • Manual verification against a real workspace API token

🤖 Generated with Claude Code

…aved replies, and teams

Adds workspace-token endpoints under the `inbox` scope covering conversation
assignment/archiving/read-follow-bot actions, conversation-scoped messages
(list/get/create/edit/delete/attributes), saved replies CRUD, and enterprise
team CRUD/membership — each handler delegates to the same business-layer
service method the private UI action already calls. Also fixes a missing
workspaceId scope on conversationService.updateAssignment's bulk WHERE
clause, which would have made the new assignment endpoint a cross-tenant
write.

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