Skip to content

ChatClient

Defined in: libs/ccs-chat-client/src/chat-client.ts:57

Server-side SDK for a trusted tenant backend integrating with Chat through a machine client — e.g. a Fitness backend that decides which coach may talk to which client, then creates that conversation and posts on behalf of one of them.

  • Tokens: RFC 6749 client_credentials, form-encoded at {issuerUrl}/oauth/token with HTTP Basic auth, scope and resource; cached until exp - 60 s.
  • Every call goes to /tenants/:tenant_id/applications/:application_id/... for the configured context, which must be the client’s own (Chat binds a machine client to its tenant/app, D9).
  • Errors are typed: ChatUnauthorizedError (401), ChatForbiddenError (403), ChatNotFoundError (404), ChatUnprocessableError (422), otherwise ChatApiError.

new ChatClient(options): ChatClient

Defined in: libs/ccs-chat-client/src/chat-client.ts:75

ChatClientOptions

ChatClient

readonly conversations: ConversationsResource

Defined in: libs/ccs-chat-client/src/chat-client.ts:58


readonly channels: ChannelsResource

Defined in: libs/ccs-chat-client/src/chat-client.ts:60

Convenience over conversations with type: 'CHANNEL'.


readonly messages: MessagesResource

Defined in: libs/ccs-chat-client/src/chat-client.ts:61


readonly users: UsersResource

Defined in: libs/ccs-chat-client/src/chat-client.ts:62