Skip to main content

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

ParameterTypeDescription
authTokenstringYour Comms API token.
options?CommsApiOptionsOptional configuration options.

Returns

CommsApi

Properties

PropertyModifierType
channelspublicChannelsClient
commentspublicCommentsClient
conversationMessagespublicConversationMessagesClient
conversationspublicConversationsClient
groupspublicGroupsClient
inboxpublicInboxClient
reactionspublicReactionsClient
searchpublicSearchClient
threadspublicThreadsClient
userspublicUsersClient
workspacespublicWorkspacesClient
workspaceUserspublicWorkspaceUsersClient

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>