Skip to main content

InboxClient

Client for /api/v1/inbox/.

Extends

  • BaseClient

Constructors

Constructor

new InboxClient(config: ClientConfig): InboxClient;

Parameters

ParameterType
configClientConfig

Returns

InboxClient

Inherited from

BaseClient.constructor

Properties

PropertyModifierType
apiTokenreadonlystring
baseUrl?readonlystring
customFetch?readonlyCustomFetch
defaultVersionreadonly"v1"

Methods

archiveAll()

archiveAll(args: ArchiveAllArgs): Promise<void>;

Archives all inbox items in a workspace.

Parameters

ParameterTypeDescription
argsArchiveAllArgsThe arguments for archiving all.

Returns

Promise<void>

Example

await api.inbox.archiveAll({
workspaceId: 123,
olderThan: new Date('2024-01-01'),
})

archiveThread()

archiveThread(id: string): Promise<void>;

Archives a thread in the inbox.

Parameters

ParameterTypeDescription
idstringThe thread ID.

Returns

Promise<void>

Example

await api.inbox.archiveThread('7YpL3oZ4kZ9vP7Q1tR2sX3z')

getBaseUri()

protected getBaseUri(): string;

Returns the base URI for an API request, with a guaranteed trailing slash so relative paths resolve cleanly through URL.

Returns

string

Inherited from

BaseClient.getBaseUri

getCount()

getCount(workspaceId: number): Promise<number>;

Gets unread count for inbox.

Parameters

ParameterTypeDescription
workspaceIdnumberThe workspace ID.

Returns

Promise<number>

The unread count.

Example

const count = await api.inbox.getCount(123)
console.log(`Unread items: ${count}`)

getInbox()

getInbox(args: GetInboxArgs): Promise<{
actions?: unknown[] | null;
attachments?: | {
[key: string]: unknown;
attachmentId: string;
description?: string | null;
duration?: string | null;
fileName?: string | null;
fileSize?: number | null;
image?: string | null;
imageHeight?: number | null;
imageWidth?: number | null;
title?: string | null;
underlyingType?: string | null;
uploadState?: string | null;
url?: string | null;
urlType: string;
video?: string | null;
videoAutoPlay?: boolean | null;
videoType?: string | null;
}[]
| null;
channelId: string;
closed: boolean;
commentCount: number;
content: string;
creator: number;
creatorName?: string | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
groups?: string[] | null;
id: string;
inInbox: boolean;
isArchived: boolean;
isSaved?: boolean | null;
lastComment?: | {
actions?: unknown[] | null;
attachments?: | {
[key: string]: unknown;
attachmentId: string;
description?: string | null;
duration?: string | null;
fileName?: string | null;
fileSize?: number | null;
image?: string | null;
imageHeight?: number | null;
imageWidth?: number | null;
title?: string | null;
underlyingType?: string | null;
uploadState?: string | null;
url?: string | null;
urlType: string;
video?: string | null;
videoAutoPlay?: boolean | null;
videoType?: string | null;
}[]
| null;
channelId: string;
content: string;
conversationId?: string | null;
creator: number;
creatorName?: string | null;
deleted?: boolean | null;
deletedBy?: number | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
groups?: string[] | null;
id: string;
lastEdited?: Date | null;
objIndex?: number | null;
posted: Date;
reactions?: Record<string, unknown> | null;
recipients?: number[] | null;
systemMessage?: unknown;
threadId: string;
toEmails?: string[] | null;
url: string;
version?: number | null;
workspaceId: number;
}
| null;
lastEdited?: Date | null;
lastObjIndex?: number | null;
lastUpdated: Date;
mutedUntil?: Date | null;
participants?: number[] | null;
pinned?: boolean;
pinnedTs?: number | null;
posted: Date;
reactions?: Record<string, number[]> | null;
recipients?: number[] | null;
responders?: number[] | null;
snippet: string;
snippetCreator: number;
snippetMaskAvatarUrl?: string | null;
snippetMaskPoster?: string | null;
systemMessage?: unknown;
title: string;
toEmails?: string[] | null;
url: string;
version?: number | null;
workspaceId: number;
}[]>;

Gets inbox items (threads).

Parameters

ParameterTypeDescription
argsGetInboxArgsThe arguments for getting inbox.

Returns

Promise<{ actions?: unknown[] | null; attachments?: | { [key: string]: unknown; attachmentId: string; description?: string | null; duration?: string | null; fileName?: string | null; fileSize?: number | null; image?: string | null; imageHeight?: number | null; imageWidth?: number | null; title?: string | null; underlyingType?: string | null; uploadState?: string | null; url?: string | null; urlType: string; video?: string | null; videoAutoPlay?: boolean | null; videoType?: string | null; }[] | null; channelId: string; closed: boolean; commentCount: number; content: string; creator: number; creatorName?: string | null; directGroupMentions?: string[] | null; directMentions?: number[] | null; groups?: string[] | null; id: string; inInbox: boolean; isArchived: boolean; isSaved?: boolean | null; lastComment?: | { actions?: unknown[] | null; attachments?: | { [key: string]: unknown; attachmentId: string; description?: string | null; duration?: string | null; fileName?: string | null; fileSize?: number | null; image?: string | null; imageHeight?: number | null; imageWidth?: number | null; title?: string | null; underlyingType?: string | null; uploadState?: string | null; url?: string | null; urlType: string; video?: string | null; videoAutoPlay?: boolean | null; videoType?: string | null; }[] | null; channelId: string; content: string; conversationId?: string | null; creator: number; creatorName?: string | null; deleted?: boolean | null; deletedBy?: number | null; directGroupMentions?: string[] | null; directMentions?: number[] | null; groups?: string[] | null; id: string; lastEdited?: Date | null; objIndex?: number | null; posted: Date; reactions?: Record<string, unknown> | null; recipients?: number[] | null; systemMessage?: unknown; threadId: string; toEmails?: string[] | null; url: string; version?: number | null; workspaceId: number; } | null; lastEdited?: Date | null; lastObjIndex?: number | null; lastUpdated: Date; mutedUntil?: Date | null; participants?: number[] | null; pinned?: boolean; pinnedTs?: number | null; posted: Date; reactions?: Record<string, number[]> | null; recipients?: number[] | null; responders?: number[] | null; snippet: string; snippetCreator: number; snippetMaskAvatarUrl?: string | null; snippetMaskPoster?: string | null; systemMessage?: unknown; title: string; toEmails?: string[] | null; url: string; version?: number | null; workspaceId: number; }[]>

Inbox threads.

Example

const inbox = await api.inbox.getInbox({
workspaceId: 123,
newerThan: new Date('2024-01-01'),
})

// Include archived (done) items alongside active ones
const allInbox = await api.inbox.getInbox({
workspaceId: 123,
archiveFilter: 'all',
})

getLinkBaseUrl()

protected getLinkBaseUrl(): string | undefined;

Base URL for entity web links, or undefined to use getFullCommsURL's default web app. Trailing-slash normalization happens in getFullCommsURL, so the configured value is returned verbatim.

Returns

string | undefined

Inherited from

BaseClient.getLinkBaseUrl

markAllRead()

markAllRead(workspaceId: number): Promise<void>;

Marks all inbox items as read in a workspace.

Parameters

ParameterTypeDescription
workspaceIdnumberThe workspace ID.

Returns

Promise<void>

Example

await api.inbox.markAllRead(123)

unarchiveThread()

unarchiveThread(id: string): Promise<void>;

Unarchives a thread in the inbox.

Parameters

ParameterTypeDescription
idstringThe thread ID.

Returns

Promise<void>

Example

await api.inbox.unarchiveThread('7YpL3oZ4kZ9vP7Q1tR2sX3z')