CommsApi
The main API client for interacting with the Comms REST API.
Example
import { CommsApi } from '@doist/comms-sdk'
const api = new CommsApi('your-api-token')
const user = await api.users.getSessionUser()
Constructors
Constructor
new CommsApi(authToken: string, options?: CommsApiOptions): CommsApi;
Creates a new Comms API client.
Parameters
| Parameter | Type | Description |
|---|---|---|
authToken | string | Your Comms API token. |
options? | CommsApiOptions | Optional configuration options. |
Returns
CommsApi
Properties
| Property | Modifier | Type |
|---|---|---|
channels | public | ChannelsClient |
comments | public | CommentsClient |
conversationMessages | public | ConversationMessagesClient |
conversations | public | ConversationsClient |
groups | public | GroupsClient |
inbox | public | InboxClient |
reactions | public | ReactionsClient |
search | public | SearchClient |
threads | public | ThreadsClient |
users | public | UsersClient |
workspaces | public | WorkspacesClient |
workspaceUsers | public | WorkspaceUsersClient |
Methods
close()
close(): Promise<void>;
Drains the SDK's process-global connection pool. CLIs and scripts
should await api.close() before exit so Node's event loop empties
immediately instead of waiting ~4s on keep-alive. Affects every
CommsApi and OAuth helper in the same process — it's a
process-shutdown gesture, not an instance teardown. Browser-safe.
Returns
Promise<void>