Let applications define inbox channels
Why
An app that wants a shared inbox queue (twenty-eng's Factory channel) has to work around the platform today. It looks up a channel by name from a variable, names every recipient member, moves the thread into the channel after sending, and gives its role canAccessAllAgentChatChannels. Apps can't declare channels, and sendInboxMessage can't address one.
Why it wasn't done before
- https://github.com/twentyhq/twenty/pull/29089 let apps create channels at runtime through the API. It was closed after review questioned whether we want apps creating channels at all.
- https://github.com/twentyhq/twenty/pull/29280 (channel addressing for
sendInboxMessage) went stale.
This PR takes the declarative route instead. A channel is a syncable manifest entity, like navigation menu items, owned by the app and removed with it. Worth a look from whoever reviewed #29089.
What
SDK / CLI
defineInboxChannel({ universalIdentifier, name, icon?, color?, roleUniversalIdentifiers? }), with manifest build andpull(src/inbox-channels/*.inbox-channel.ts).sendInboxMessage({ inboxChannelUniversalIdentifier }).workspaceMemberIdsbecomes optional when a channel is named.
Server
- Manifest sync and export of channels and their role links (deterministic link ids). A role outside the manifest is rejected.
- The application grant role copies the requested role's channel links, so the app token has the access the manifest declares. Without this, an app couldn't post to its own channel.
- Workspace edits:
- name, icon, color and position stay workspace-owned, so a rename survives later syncs;
- Settings can't delete an app channel (
CHAT_CHANNEL_IS_FROM_APPLICATION); - saving roles in Settings keeps links owned by apps and grant roles.
- Deleting a channel, by dropping it from the manifest or uninstalling the app:
- a side-effect handler drops its role links, views and navigation items;
- a listener moves its conversations to General.
- Migration-created channels also get their views and grant rewrites through the same listener.
sendInboxMessagechecks the caller's channel access before writing, then files new conversations (or older unowned, unfiled ones) in the channel.- Regenerated metadata clients (twenty-client-sdk, twenty-front).
Docs: the app Inbox page (channels and channel sends), concepts, pull coverage and the agent-skills reference.
Tests
- New integration spec
chat-channel-application-manifest:- sync creates the channel with links for the app role and its grant;
- an app token posts to the channel without members;
- an inaccessible channel is refused;
- a workspace rename and
roleIds: []keep the name and the grant; - Settings delete is refused;
- a foreign role is rejected;
- dropping the channel from the manifest deletes it, its links and its views, and moves its conversations to General.
- These integration suites pass locally: existing inbox, channel and grant-role suites (128 tests).
- Server unit tests for application, agent-chat-channel, ai-chat, side effects and MCP pass (1737).
- SDK define and CLI tests pass; the CLI manifest snapshots only gain
inboxChannels: [].
The MCP tools for managing inbox channels are in https://github.com/twentyhq/twenty/pull/32285.
Generated by Claude Code