๐ฃ๏ธ Chat routes
Chat routes are SDK composers, not Express middleware. The inventory and details below document the exact public HTTP and WebSocket endpoints.
Inventoryโ
Detailsโ
createChatChannelRouteโ
Implementation
Endpoint: POST /channels
Access: isAuthenticated() โ some(...) โ checkIdentityType(...) โ isSelf(...) execute in the source order shown here. Exact invocation: isAuthenticated(), some( checkIdentityType(['admin']), isSelf(['params', 'requestBody', 'ownerId']) ),.
Request: createChatChannelSchema validates the application/json body: Required name and ownerId; optional nullable icon.
Pipeline: createChatChannel โ getChatChannelById โ createChatChannelTerminator.
Success: 201 with the normalized channel in the response descriptorโs data.
Failure: Authentication and authorization failures follow the linked validators before the handler pipeline. Pipeline failures follow the linked handler/block contracts and shared error middleware; this route adds no separate inline error mapping.View complete source
findChatChannelsRouteโ
Implementation
Endpoint: GET /channels
Access: isAuthenticated() โ some(...) โ checkIdentityType(...) โ isSelf(...) execute in the source order shown here. Exact invocation: isAuthenticated(), some( checkIdentityType(['admin']), isSelf(['params', 'requestQuery', 'ownerId']) ),.
Request: findChatChannelsSchema validates query parameters: Optional name, ownerId, and shared pagination fields.
Pipeline: findChatChannels โ normalizeChatChannelsListTerminator.
Success: 200 with normalized channels and pagination metadata.
Failure: Authentication and authorization failures follow the linked validators before the handler pipeline. Pipeline failures follow the linked handler/block contracts and shared error middleware; this route adds no separate inline error mapping.View complete source
getChatChannelRouteโ
Implementation
Endpoint: GET /channels/:channelId
Access: isAuthenticated() โ some(...) โ checkIdentityType(...) โ ownsChannel(...) โ hasSubscription(...) execute in the source order shown here. Exact invocation: isAuthenticated(), some( checkIdentityType(['admin']), ownsChannel(['params', 'requestParams', 'channelId']), hasSubscription(['params', 'requestParams', 'channelId']) ),.
Request: getChatChannelSchema validates path parameters: Required channelId.
Pipeline: getChatChannelById โ normalizeChatChannelTerminator.
Success: 200 with the normalized channel.
Failure: Authentication and authorization failures follow the linked validators before the handler pipeline. Pipeline failures follow the linked handler/block contracts and shared error middleware; this route adds no separate inline error mapping.View complete source
updateChatChannelRouteโ
Implementation
Endpoint: PATCH /channels/:channelId
Access: isAuthenticated() โ some(...) โ checkIdentityType(...) โ ownsChannel(...) execute in the source order shown here. Exact invocation: isAuthenticated(), some( checkIdentityType(['admin']), ownsChannel(['params', 'requestParams', 'channelId']) ),.
Request: updateChatChannelSchema validates path parameters and the application/json body: Required channelId; body permits optional name and nullable icon.
Pipeline: updateChatChannel โ getChatChannelById โ normalizeChatChannelTerminator.
Success: 200 with the updated, normalized channel.
Failure: Authentication and authorization failures follow the linked validators before the handler pipeline. Pipeline failures follow the linked handler/block contracts and shared error middleware; this route adds no separate inline error mapping.View complete source
deleteChatChannelRouteโ
Implementation
Endpoint: DELETE /channels/:channelId
Access: isAuthenticated() โ some(...) โ checkIdentityType(...) โ ownsChannel(...) execute in the source order shown here. Exact invocation: isAuthenticated(), some( checkIdentityType(['admin']), ownsChannel(['params', 'requestParams', 'channelId']) ),.
Request: deleteChatChannelSchema validates path parameters: Required channelId.
Pipeline: deleteChatChannel โ deleteChatChannelTerminator.
Success: Empty 204 response.
Failure: Authentication and authorization failures follow the linked validators before the handler pipeline. Pipeline failures follow the linked handler/block contracts and shared error middleware; this route adds no separate inline error mapping.View complete source
getChannelMessagesRouteโ
Implementation
Endpoint: GET /channels/:channelId/messages
Access: isAuthenticated() โ hasSubscription(...) โ channelExists(...) execute in the source order shown here. Exact invocation: isAuthenticated(), channelExists(['params', 'requestParams', 'channelId']), hasSubscription(['params', 'requestParams', 'channelId']),.
Request: getChannelMessagesSchema validates path and query parameters: Required channelId and optional shared pagination fields.
Pipeline: getChannelMessagesByChannelId โ pagination โ normalizeChatMessages โ response projection.
Success: 200 with normalized messages and pagination metadata.
Failure: Authentication and authorization failures follow the linked validators before the handler pipeline. This route maps ChatChannelUnknownError โ 500 as shown in its source.View complete source
getChatChannelIconUploadUrlRouteโ
Implementation
Endpoint: GET /channels/:channelId/icon-upload-url
Access: isAuthenticated() โ some(...) โ checkIdentityType(...) โ ownsChannel(...) execute in the source order shown here. Exact invocation: isAuthenticated(), some( checkIdentityType(['admin']), ownsChannel(['params', 'requestParams', 'channelId']) ),.
Request: The shared getSignedImageUploadUrlSchema validates the path channelId and the signed-image upload request contract.
Pipeline: generateChatChannelIconUploadUrl โ orThrow.
Success: 200 with { objectId, url }.
Failure: Authentication and authorization failures follow the linked validators before the handler pipeline. This route maps FileStorageServiceError โ 500, ChatChannelUnknownError โ 500 as shown in its source.View complete source
createChatMessageRouteโ
Implementation
Endpoint: POST /messages
Access: isAuthenticated() โ isSelf(...) โ hasSubscription(...) execute in the source order shown here. Exact invocation: isAuthenticated(), isSelf(['params', 'requestBody', 'senderId']), hasSubscription(['params', 'requestBody', 'channelId']),.
Request: createChatMessageSchema validates the application/json body: Required content, senderId, and channelId; optional title.
Pipeline: createChatMessage โ getChatMessageById โ normalizeChatMessage โ orThrow.
Success: 201 with the normalized message and signed attachment URLs.
Failure: Authentication and authorization failures follow the linked validators before the handler pipeline. This route maps ChatMessageNotFoundBlockError โ 404, FileStorageServiceError โ 500, ChatMessageUnexpectedDBError โ 500 as shown in its source.View complete source
findChatMessagesRouteโ
Implementation
Endpoint: GET /messages
Access: isAuthenticated() โ some(...) โ checkIdentityType(...) โ isSelf(...) โ hasSubscription(...) execute in the source order shown here. Exact invocation: isAuthenticated(), some( checkIdentityType(['admin']), hasSubscription(['params', 'requestQuery', 'channelId']), isSelf(['params', 'requestQuery', 'senderId']) ),.
Request: findChatMessagesSchema validates query parameters: Required channelId; optional message filters and pagination.
Pipeline: findChatMessages.
Success: 200 with normalized messages and pagination metadata.
Failure: Authentication and authorization failures follow the linked validators before the handler pipeline. This route maps ChatMessageNotFoundBlockError โ 404, FileStorageServiceError โ 500, ChatMessageBlockError โ 500 as shown in its source.View complete source
getChatMessageRouteโ
Implementation
Endpoint: GET /messages/:messageId
Access: isAuthenticated() โ some(...) โ checkIdentityType(...) โ ownsMessage(...) execute in the source order shown here. Exact invocation: isAuthenticated(), some( checkIdentityType(['admin']), ownsMessage(['params', 'requestParams', 'messageId']) ),.
Request: getChatMessageSchema validates path parameters: Required messageId.
Pipeline: getChatMessageById โ normalizeChatMessage โ orThrow.
Success: 200 with the normalized message.
Failure: Authentication and authorization failures follow the linked validators before the handler pipeline. This route maps ChatMessageNotFoundBlockError โ 404, FileStorageServiceError โ 500, ChatMessageBlockError โ 500 as shown in its source.View complete source
updateChatMessageRouteโ
Implementation
Endpoint: PATCH /messages/:messageId
Access: isAuthenticated() โ ownsMessage(...) execute in the source order shown here. Exact invocation: isAuthenticated(), ownsMessage(['params', 'requestParams', 'messageId']),.
Request: updateChatMessageSchema validates path parameters and the application/json body: Required messageId; optional content, senderId, and title.
Pipeline: updateChatMessage โ getChatMessageById.
Success: 200 with the updated, normalized message.
Failure: Authentication and authorization failures follow the linked validators before the handler pipeline. This route maps ChatMessageNotFoundBlockError โ 404, FileStorageServiceError โ 500, ChatMessageBlockError โ 500 as shown in its source.View complete source
deleteChatMessageRouteโ
Implementation
Endpoint: DELETE /messages/:messageId
Access: isAuthenticated() โ some(...) โ checkIdentityType(...) โ ownsMessage(...) execute in the source order shown here. Exact invocation: isAuthenticated(), some( checkIdentityType(['admin']), ownsMessage(['params', 'requestParams', 'messageId']) ),.
Request: deleteChatMessageSchema validates path parameters: Required messageId.
Pipeline: deleteChatMessage โ deleteChatMessageTerminator.
Success: Empty 204 response.
Failure: Authentication and authorization failures follow the linked validators before the handler pipeline. Pipeline failures follow the linked handler/block contracts and shared error middleware; this route adds no separate inline error mapping.View complete source
getChatMessageAttachmentUploadUrlRouteโ
Implementation
Endpoint: GET /messages/:messageId/attachment-upload-url
Access: isAuthenticated() โ ownsMessage(...) execute in the source order shown here. Exact invocation: isAuthenticated(), ownsMessage(['params', 'requestParams', 'messageId']),.
Request: The shared getSignedFileUploadUrlSchema validates the path messageId and the signed-file upload request contract.
Pipeline: generateChatMessageAttachmentUploadUrl โ orThrow.
Success: 200 with { objectId, url }.
Failure: Authentication and authorization failures follow the linked validators before the handler pipeline. This route maps FileStorageServiceError โ 500, ChatMessageBlockError โ 500 as shown in its source.View complete source
streamChatMessagesRouteโ
Implementation
Endpoint: ws /messages/listen
Access: No active validator. The source comments out isAuthenticated() and hasSubscription(...), so the current WebSocket endpoint does not enforce Bearer/cookie authentication or channel membership.
Request: streamChatMessagesSchema validates query parameters: Required channelId.
Pipeline: streamChatMessages โ normalizeChatMessageStream โ orThrow, producing the WebSocket subject.
Success: A WebSocket subject that emits normalized inserted messages and serializes each value as JSON.
Failure: No access validator runs. Pipeline mappings are ChatMessageBadRequestError โ 400, ChatMessageUnknownError โ 500; subject/database failures can also terminate the WebSocket stream.View complete source
createChatMessageAttachmentRouteโ
Implementation
Endpoint: POST /messages/:messageId/attachments
Access: isAuthenticated() โ ownsMessage(...) execute in the source order shown here. Exact invocation: isAuthenticated(), ownsMessage(['params', 'requestParams', 'messageId']),.
Request: createChatMessageAttachmentSchema validates the application/json body: Required UUID objectId and string type.
Pipeline: createChatMessageAttachment โ getChatMessageAttachmentById โ normalizeChatMessageAttachment โ orThrow.
Success: 201 with the normalized attachment { type, url }.
Failure: Authentication and authorization failures follow the linked validators before the handler pipeline. This route maps ChatMessageNotFoundBlockError โ 404, ChatMessageAttachmentNotFoundBlockError โ 404, ChatMessageUnexpectedDBError โ 500 as shown in its source.View complete source
deleteChatMessageAttachmentRouteโ
Implementation
Endpoint: DELETE /messages/:messageId/attachments/:attachmentId
Access: isAuthenticated() โ some(...) โ checkIdentityType(...) โ ownsMessage(...) execute in the source order shown here. Exact invocation: isAuthenticated(), some( checkIdentityType(['admin']), ownsMessage(['params', 'requestParams', 'messageId']) ),.
Request: deleteChatMessageAttachmentSchema validates path parameters: Required messageId and attachmentId.
Pipeline: deleteChatMessageAttachment โ orThrow.
Success: Empty 204 response after metadata and stored file deletion.
Failure: Authentication and authorization failures follow the linked validators before the handler pipeline. This route maps ChatMessageNotFoundBlockError โ 404, ChatMessageAttachmentNotFoundBlockError โ 404, ChatMessageUnexpectedDBError โ 500, ChatMessageBlockError โ 500, FileStorageServiceError โ 500 as shown in its source.View complete source
createChatMessageTemplateRouteโ
Implementation
Endpoint: POST /message-templates
Access: isAuthenticated() โ some(...) โ checkIdentityType(...) โ hasOrgRole(...) execute in the source order shown here. Exact invocation: isAuthenticated(), some( checkIdentityType(['admin']), hasOrgRole( ['owner', 'admin'], ['params', 'requestBody', 'organizationId'] ) ),.
Request: createChatMessageTemplateSchema validates the application/json body: Required content and title; optional organizationId.
Pipeline: createChatMessageTemplate โ getChatMessageTemplateById โ orThrow.
Success: 201 with the created template, excluding MongoDB _id.
Failure: Authentication and authorization failures follow the linked validators before the handler pipeline. This route maps ChatMessageTemplateNotFoundError โ 404, ChatMessageTemplateInternalError โ 500, ChatMessageTemplateDbError โ 500 as shown in its source.View complete source
getChatMessageTemplateRouteโ
Implementation
Endpoint: GET /message-templates/:messageTemplateId
Access: isAuthenticated() โ some(...) โ checkIdentityType(...) โ hasOrganizationAccessToMessageTemplate(...) execute in the source order shown here. Exact invocation: isAuthenticated(), some( checkIdentityType(['admin']), hasOrganizationAccessToMessageTemplate( ['owner', 'admin'], ['params', 'requestParams', 'messageTemplateId'] ) ),.
Request: getChatMessageTemplateSchema validates path parameters: Required messageTemplateId.
Pipeline: getChatMessageTemplateById โ orThrow.
Success: 200 with the template, excluding MongoDB _id.
Failure: Authentication and authorization failures follow the linked validators before the handler pipeline. This route maps ChatMessageTemplateNotFoundError โ 404, ChatMessageTemplateUnauthorizedError โ 403, ChatMessageTemplateInternalError โ 500, ChatMessageTemplateDbError โ 500 as shown in its source.View complete source
updateChatMessageTemplateRouteโ
Implementation
Endpoint: PATCH /message-templates/:messageTemplateId
Access: isAuthenticated() โ some(...) โ checkIdentityType(...) โ hasOrganizationAccessToMessageTemplate(...) execute in the source order shown here. Exact invocation: isAuthenticated(), some( checkIdentityType(['admin']), hasOrganizationAccessToMessageTemplate( ['owner', 'admin'], ['params', 'requestParams', 'messageTemplateId'] ) ),.
Request: updateChatMessageTemplateSchema validates path parameters and the application/json body: Required template ID; optional content and title.
Pipeline: updateChatMessageTemplate โ getChatMessageTemplateById โ orThrow.
Success: 200 with the updated template, excluding MongoDB _id.
Failure: Authentication and authorization failures follow the linked validators before the handler pipeline. This route maps ChatMessageTemplateNotFoundError โ 404, ChatMessageTemplateUnauthorizedError โ 403, ChatMessageTemplateInternalError โ 500, ChatMessageTemplateDbError โ 500 as shown in its source.View complete source
deleteChatMessageTemplateRouteโ
Implementation
Endpoint: DELETE /message-templates/:messageTemplateId
Access: isAuthenticated() โ some(...) โ checkIdentityType(...) โ hasOrganizationAccessToMessageTemplate(...) execute in the source order shown here. Exact invocation: isAuthenticated(), some( checkIdentityType(['admin']), hasOrganizationAccessToMessageTemplate( ['owner', 'admin'], ['params', 'requestParams', 'messageTemplateId'] ) ),.
Request: deleteChatMessageTemplateSchema validates path parameters: Required messageTemplateId.
Pipeline: deleteChatMessageTemplate โ orThrow.
Success: Empty 204 response.
Failure: Authentication and authorization failures follow the linked validators before the handler pipeline. This route maps ChatMessageTemplateNotFoundError โ 404, ChatMessageTemplateUnauthorizedError โ 403, ChatMessageTemplateInternalError โ 500, ChatMessageTemplateDbError โ 500 as shown in its source.View complete source
findChatMessageTemplatesRouteโ
Implementation
Endpoint: GET /message-templates
Access: isAuthenticated() โ checkIdentityType(...) execute in the source order shown here. Exact invocation: isAuthenticated(), checkIdentityType(['admin']).
Request: findChatMessageTemplatesSchema validates query parameters: Shared pagination fields only.
Pipeline: findChatMessageTemplates โ pagination โ shared normalizeDocuments โ orThrow.
Success: 200 with normalized templates and pagination metadata.
Failure: Authentication and authorization failures follow the linked validators before the handler pipeline. This route maps ChatMessageTemplateNotFoundError โ 404, ChatMessageTemplateUnauthorizedError โ 403, ChatMessageTemplateInternalError โ 500, ChatMessageTemplateDbError โ 500 as shown in its source.View complete source
findChatMessageTemplatesForOrganizationRouteโ
Implementation
Endpoint: GET /organizations/:organizationId/message-templates
Access: isAuthenticated() โ hasOrgRole(...) execute in the source order shown here. Exact invocation: isAuthenticated(), hasOrgRole( ['owner', 'admin'], ['params', 'requestParams', 'organizationId'] ),.
Request: findChatMessageTemplatesForOrganizationSchema validates path and query parameters: Required organizationId and shared pagination fields.
Pipeline: buildFilterToGetChatMessageTemplatesByOrganizationId โ findChatMessageTemplates โ pagination โ shared normalizeDocuments โ orThrow.
Success: 200 with normalized templates for the path organization and pagination metadata.
Failure: Authentication and authorization failures follow the linked validators before the handler pipeline. This route maps ChatMessageTemplateNotFoundError โ 404, ChatMessageTemplateUnauthorizedError โ 403, ChatMessageTemplateInternalError โ 500, ChatMessageTemplateDbError โ 500 as shown in its source.View complete source
upsertChatChannelReadStateRouteโ
Implementation
Endpoint: PUT /channels/:channelId/read-state
Access: isAuthenticated() โ isSelf(...) โ hasSubscription(...) โ channelExists(...) execute in the source order shown here. Exact invocation: isAuthenticated(), channelExists(['params', 'requestParams', 'channelId']), hasSubscription(['params', 'requestParams', 'channelId']), isSelf(['params', 'requestBody', 'identityId']),.
Request: upsertChatChannelReadStateSchema validates path parameters and the application/json body: Required channelId, identityId, and lastReadMessageId.
Pipeline: findChatMessages.
Success: Empty 204 response after creating or updating the read state.
Failure: Authentication and authorization failures follow the linked validators before the handler pipeline. This route maps ChatChannelReadStateNotFoundError โ 404, ChatChannelReadStateDatabaseError โ 500, ChatChannelReadStateUnknownError โ 500 as shown in its source.View complete source
createChatSubscriptionRouteโ
Implementation
Endpoint: POST /subscriptions
Access: isAuthenticated() โ some(...) โ checkIdentityType(...) โ isSelf(...) execute in the source order shown here. Exact invocation: isAuthenticated(), some( checkIdentityType(['admin']), isSelf(['params', 'requestBody', 'subscribedId']) ),.
Request: createChatSubscriptionSchema validates the application/json body: Required channelId and subscribedId; other subscription fields optional.
Pipeline: createChatSubscription โ getChatSubscriptionById โ createChatSubscriptionTerminator.
Success: 201 with the created subscription in the response descriptorโs data.
Failure: Authentication and authorization failures follow the linked validators before the handler pipeline. Pipeline failures follow the linked handler/block contracts and shared error middleware; this route adds no separate inline error mapping.View complete source
findChatSubscriptionsRouteโ
Implementation
Endpoint: GET /subscriptions
Access: isAuthenticated() โ some(...) โ checkIdentityType(...) โ isSelf(...) โ ownsChannel(...) โ hasSubscription(...) execute in the source order shown here. Exact invocation: isAuthenticated(), some( checkIdentityType(['admin']), hasSubscription(['params', 'requestQuery', 'channelId']), ownsChannel(['params', 'requestQuery', 'channelId']), isSelf(['params', 'requestQuery', 'subscribedId']) ),.
Request: findChatSubscriptionsSchema validates query parameters: Optional subscription filters and shared pagination fields.
Pipeline: findChatSubscriptions โ normalizeChatSubscriptionsListTerminator.
Success: 200 with normalized subscriptions and pagination metadata.
Failure: Authentication and authorization failures follow the linked validators before the handler pipeline. Pipeline failures follow the linked handler/block contracts and shared error middleware; this route adds no separate inline error mapping.View complete source
getChatSubscriptionRouteโ
Implementation
Endpoint: GET /subscriptions/:subscriptionId
Access: isAuthenticated() โ some(...) โ checkIdentityType(...) โ ownsSubscription(...) execute in the source order shown here. Exact invocation: isAuthenticated(), some( checkIdentityType(['admin']), ownsSubscription(['params', 'requestParams', 'subscriptionId']) ),.
Request: getChatSubscriptionSchema validates path parameters: Required subscriptionId.
Pipeline: getChatSubscriptionById โ normalizeChatSubscriptionTerminator.
Success: 200 with the subscription excluding MongoDB _id.
Failure: Authentication and authorization failures follow the linked validators before the handler pipeline. Pipeline failures follow the linked handler/block contracts and shared error middleware; this route adds no separate inline error mapping.View complete source
deleteChatSubscriptionRouteโ
Implementation
Endpoint: DELETE /subscriptions/:subscriptionId
Access: isAuthenticated() โ some(...) โ checkIdentityType(...) โ ownsSubscription(...) execute in the source order shown here. Exact invocation: isAuthenticated(), some( checkIdentityType(['admin']), ownsSubscription(['params', 'requestParams', 'subscriptionId']) ),.
Request: deleteChatSubscriptionSchema validates path parameters: Required subscriptionId.
Pipeline: deleteChatSubscription โ deleteChatSubscriptionTerminator.
Success: Empty 204 response.
Failure: Authentication and authorization failures follow the linked validators before the handler pipeline. Pipeline failures follow the linked handler/block contracts and shared error middleware; this route adds no separate inline error mapping.View complete source