ThreadsClient
Client for /api/v1/threads/. The SDK auto-generates the thread id on
createThread when the caller doesn't supply one.
Extends
BaseClient
Constructors
Constructor
new ThreadsClient(config: ClientConfig): ThreadsClient;
Parameters
| Parameter | Type |
|---|---|
config | ClientConfig |
Returns
ThreadsClient
Inherited from
BaseClient.constructor
Properties
| Property | Modifier | Type |
|---|---|---|
apiToken | readonly | string |
baseUrl? | readonly | string |
customFetch? | readonly | CustomFetch |
defaultVersion | readonly | "v1" |
Methods
clearUnread()
clearUnread(workspaceId: number): Promise<{
status: "ok";
}>;
Clears unread threads in a workspace.
Parameters
| Parameter | Type | Description |
|---|---|---|
workspaceId | number | The workspace ID. |
Returns
Promise<{
status: "ok";
}>
closeThread()
closeThread(args: ThreadActionCommentArgs): 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;
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;
}>;
Closes a thread by adding a comment with a close action.
Parameters
| Parameter | Type | Description |
|---|---|---|
args | ThreadActionCommentArgs | The arguments for closing a thread. |
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;
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;
}>
The created comment object.
Example
const comment = await api.threads.closeThread({
id: '7YpL3oZ4kZ9vP7Q1tR2sX3z',
content: 'Closing this thread — resolved.',
})
createThread()
createThread(args: {
channelId: string;
content: string;
groups?: string[] | null;
id?: string;
recipients?: number[] | null;
title?: string | null;
}): 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 | null;
commentCount: number;
content: string;
creator: number;
creatorName?: string | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
groups?: string[] | null;
id: string;
inInbox?: boolean | null;
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;
creator: number;
creatorName: string;
deleted: boolean;
deletedBy?: number | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
groups?: string[] | null;
id: string;
lastEdited?: Date | null;
objIndex: number;
posted: Date;
reactions?: Record<string, number[]> | null;
recipients?: number[] | null;
systemMessage?: unknown;
threadId: string;
toEmails?: string[] | null;
version: number;
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, unknown> | 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;
workspaceId: number;
}>;
Creates a new thread in a channel. id is auto-generated if not supplied.
Parameters
| Parameter | Type | Description |
|---|---|---|
args | { channelId: string; content: string; groups?: string[] | null; id?: string; recipients?: number[] | null; title?: string | null; } | The arguments for creating a thread. |
args.channelId | string | The channel ID. |
args.content | string | The thread content. |
args.groups? | string[] | null | Optional array of custom group IDs to notify. |
args.id? | string | - |
args.recipients? | number[] | null | Optional array of user IDs to notify. |
args.title? | string | null | Optional thread title. |
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 | null;
commentCount: number;
content: string;
creator: number;
creatorName?: string | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
groups?: string[] | null;
id: string;
inInbox?: boolean | null;
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;
creator: number;
creatorName: string;
deleted: boolean;
deletedBy?: number | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
groups?: string[] | null;
id: string;
lastEdited?: Date | null;
objIndex: number;
posted: Date;
reactions?: Record<string, number[]> | null;
recipients?: number[] | null;
systemMessage?: unknown;
threadId: string;
toEmails?: string[] | null;
version: number;
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, unknown> | 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;
workspaceId: number;
}>
The created thread object.
Example
const thread = await api.threads.createThread({
channelId: '7YpL3oZ4kZ9vP7Q1tR2sX44',
title: 'New Feature Discussion',
content: 'Let\'s discuss the new feature...',
})
deleteThread()
deleteThread(id: string): Promise<{
status: "ok";
}>;
Permanently deletes a thread.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The thread ID. |
Returns
Promise<{
status: "ok";
}>
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
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
getThread()
getThread(id: string): 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 | null;
commentCount: number;
content: string;
creator: number;
creatorName?: string | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
groups?: string[] | null;
id: string;
inInbox?: boolean | null;
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;
creator: number;
creatorName: string;
deleted: boolean;
deletedBy?: number | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
groups?: string[] | null;
id: string;
lastEdited?: Date | null;
objIndex: number;
posted: Date;
reactions?: Record<string, number[]> | null;
recipients?: number[] | null;
systemMessage?: unknown;
threadId: string;
toEmails?: string[] | null;
version: number;
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, unknown> | 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;
workspaceId: number;
}>;
Gets a single thread object by id.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The thread ID. |
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 | null;
commentCount: number;
content: string;
creator: number;
creatorName?: string | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
groups?: string[] | null;
id: string;
inInbox?: boolean | null;
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;
creator: number;
creatorName: string;
deleted: boolean;
deletedBy?: number | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
groups?: string[] | null;
id: string;
lastEdited?: Date | null;
objIndex: number;
posted: Date;
reactions?: Record<string, number[]> | null;
recipients?: number[] | null;
systemMessage?: unknown;
threadId: string;
toEmails?: string[] | null;
version: number;
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, unknown> | 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;
workspaceId: number;
}>
The thread object.
getThreads()
getThreads(args: {
archived?: boolean | null;
channelId?: string | null;
limit?: number | null;
newerThan?: Date | null;
olderThan?: Date | null;
workspaceId: number;
}): 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 | null;
commentCount: number;
content: string;
creator: number;
creatorName?: string | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
groups?: string[] | null;
id: string;
inInbox?: boolean | null;
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;
creator: number;
creatorName: string;
deleted: boolean;
deletedBy?: number | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
groups?: string[] | null;
id: string;
lastEdited?: Date | null;
objIndex: number;
posted: Date;
reactions?: Record<string, number[]> | null;
recipients?: number[] | null;
systemMessage?: unknown;
threadId: string;
toEmails?: string[] | null;
version: number;
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, unknown> | 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;
workspaceId: number;
}[]>;
Gets threads. At least one of channelId / workspaceId is required.
newerThan / olderThan (Date) are converted to the
newer_than_ts / older_than_ts epoch-second params on the wire.
Parameters
| Parameter | Type | Description |
|---|---|---|
args | { archived?: boolean | null; channelId?: string | null; limit?: number | null; newerThan?: Date | null; olderThan?: Date | null; workspaceId: number; } | The arguments for getting threads. |
args.archived? | boolean | null | Optional flag to include archived threads. |
args.channelId? | string | null | Optional channel ID to narrow to a single channel. |
args.limit? | number | null | Optional limit on number of threads returned. |
args.newerThan? | Date | null | Optional date to get threads newer than. |
args.olderThan? | Date | null | Optional date to get threads older than. |
args.workspaceId | number | The workspace ID. |
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 | null;
commentCount: number;
content: string;
creator: number;
creatorName?: string | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
groups?: string[] | null;
id: string;
inInbox?: boolean | null;
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;
creator: number;
creatorName: string;
deleted: boolean;
deletedBy?: number | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
groups?: string[] | null;
id: string;
lastEdited?: Date | null;
objIndex: number;
posted: Date;
reactions?: Record<string, number[]> | null;
recipients?: number[] | null;
systemMessage?: unknown;
threadId: string;
toEmails?: string[] | null;
version: number;
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, unknown> | 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;
workspaceId: number;
}[]>
An array of thread objects.
Example
const threads = await api.threads.getThreads({
workspaceId: 123,
channelId: '7YpL3oZ4kZ9vP7Q1tR2sX44',
})
threads.forEach(t => console.log(t.title))
getUnread()
getUnread(workspaceId: number): Promise<{
data: {
channelId: string;
directMention: boolean;
objIndex: number;
threadId: string;
}[];
inboxUnread?: number | null;
version: number;
}>;
Returns unread threads for a workspace, paired with the unread version counter and (optionally) the inbox unread count.
Parameters
| Parameter | Type | Description |
|---|---|---|
workspaceId | number | The workspace ID. |
Returns
Promise<{
data: {
channelId: string;
directMention: boolean;
objIndex: number;
threadId: string;
}[];
inboxUnread?: number | null;
version: number;
}>
Object containing the array of unread thread references, a version counter, and optionally the inbox unread count.
markAllRead()
markAllRead(args: {
channelId?: string;
workspaceId?: number;
}): Promise<{
status: "ok";
}>;
Marks every thread in a workspace or channel as read. Exactly one of
workspaceId / channelId should be set.
Parameters
| Parameter | Type | Description |
|---|---|---|
args | { channelId?: string; workspaceId?: number; } | Either workspaceId or channelId (one is required). |
args.channelId? | string | The channel ID. |
args.workspaceId? | number | The workspace ID. |
Returns
Promise<{
status: "ok";
}>
Example
// Mark all in workspace
await api.threads.markAllRead({ workspaceId: 123 })
// Mark all in channel
await api.threads.markAllRead({ channelId: '7YpL3oZ4kZ9vP7Q1tR2sX44' })
markRead()
markRead(args: MarkThreadReadArgs): Promise<{
status: "ok";
}>;
Marks a thread as read.
Parameters
| Parameter | Type | Description |
|---|---|---|
args | MarkThreadReadArgs | The arguments for marking a thread as read. |
Returns
Promise<{
status: "ok";
}>
markUnread()
markUnread(args: MarkThreadUnreadArgs): Promise<{
status: "ok";
}>;
Marks a thread as unread.
Parameters
| Parameter | Type | Description |
|---|---|---|
args | MarkThreadUnreadArgs | The arguments for marking a thread as unread. |
Returns
Promise<{
status: "ok";
}>
markUnreadForOthers()
markUnreadForOthers(args: MarkThreadUnreadForOthersArgs): Promise<{
status: "ok";
}>;
Marks a thread as unread for others. Useful to notify others about thread changes.
Parameters
| Parameter | Type | Description |
|---|---|---|
args | MarkThreadUnreadForOthersArgs | The arguments for marking a thread as unread for others. |
Returns
Promise<{
status: "ok";
}>
moveToChannel()
moveToChannel(args: MoveThreadToChannelArgs): 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 | null;
commentCount: number;
content: string;
creator: number;
creatorName?: string | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
groups?: string[] | null;
id: string;
inInbox?: boolean | null;
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;
creator: number;
creatorName: string;
deleted: boolean;
deletedBy?: number | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
groups?: string[] | null;
id: string;
lastEdited?: Date | null;
objIndex: number;
posted: Date;
reactions?: Record<string, number[]> | null;
recipients?: number[] | null;
systemMessage?: unknown;
threadId: string;
toEmails?: string[] | null;
version: number;
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, unknown> | 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;
workspaceId: number;
}>;
Moves a thread to another channel.
Parameters
| Parameter | Type | Description |
|---|---|---|
args | MoveThreadToChannelArgs | The arguments for moving a thread. |
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 | null;
commentCount: number;
content: string;
creator: number;
creatorName?: string | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
groups?: string[] | null;
id: string;
inInbox?: boolean | null;
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;
creator: number;
creatorName: string;
deleted: boolean;
deletedBy?: number | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
groups?: string[] | null;
id: string;
lastEdited?: Date | null;
objIndex: number;
posted: Date;
reactions?: Record<string, number[]> | null;
recipients?: number[] | null;
systemMessage?: unknown;
threadId: string;
toEmails?: string[] | null;
version: number;
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, unknown> | 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;
workspaceId: number;
}>
The updated thread object.
muteThread()
muteThread(args: MuteThreadArgs): 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 | null;
commentCount: number;
content: string;
creator: number;
creatorName?: string | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
groups?: string[] | null;
id: string;
inInbox?: boolean | null;
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;
creator: number;
creatorName: string;
deleted: boolean;
deletedBy?: number | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
groups?: string[] | null;
id: string;
lastEdited?: Date | null;
objIndex: number;
posted: Date;
reactions?: Record<string, number[]> | null;
recipients?: number[] | null;
systemMessage?: unknown;
threadId: string;
toEmails?: string[] | null;
version: number;
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, unknown> | 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;
workspaceId: number;
}>;
Mutes a thread for a specified number of minutes. When muted, you will not get notified in your inbox about new comments.
Parameters
| Parameter | Type | Description |
|---|---|---|
args | MuteThreadArgs | The arguments for muting a thread. |
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 | null;
commentCount: number;
content: string;
creator: number;
creatorName?: string | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
groups?: string[] | null;
id: string;
inInbox?: boolean | null;
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;
creator: number;
creatorName: string;
deleted: boolean;
deletedBy?: number | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
groups?: string[] | null;
id: string;
lastEdited?: Date | null;
objIndex: number;
posted: Date;
reactions?: Record<string, number[]> | null;
recipients?: number[] | null;
systemMessage?: unknown;
threadId: string;
toEmails?: string[] | null;
version: number;
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, unknown> | 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;
workspaceId: number;
}>
The updated thread object.
Example
const thread = await api.threads.muteThread({ id: '7YpL3oZ4kZ9vP7Q1tR2sX3z', minutes: 30 })
pinThread()
pinThread(id: string): Promise<{
status: "ok";
}>;
Pins a thread.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The thread ID. |
Returns
Promise<{
status: "ok";
}>
reopenThread()
reopenThread(args: ThreadActionCommentArgs): 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;
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;
}>;
Reopens a thread by adding a comment with a reopen action.
Parameters
| Parameter | Type | Description |
|---|---|---|
args | ThreadActionCommentArgs | The arguments for reopening a thread. |
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;
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;
}>
The created comment object.
Example
const comment = await api.threads.reopenThread({
id: '7YpL3oZ4kZ9vP7Q1tR2sX3z',
content: 'Reopening — need further discussion.',
})
saveThread()
saveThread(id: string): Promise<{
status: "ok";
}>;
Saves a thread (formerly "star").
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The thread ID. |
Returns
Promise<{
status: "ok";
}>
unmuteThread()
unmuteThread(id: string): 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 | null;
commentCount: number;
content: string;
creator: number;
creatorName?: string | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
groups?: string[] | null;
id: string;
inInbox?: boolean | null;
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;
creator: number;
creatorName: string;
deleted: boolean;
deletedBy?: number | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
groups?: string[] | null;
id: string;
lastEdited?: Date | null;
objIndex: number;
posted: Date;
reactions?: Record<string, number[]> | null;
recipients?: number[] | null;
systemMessage?: unknown;
threadId: string;
toEmails?: string[] | null;
version: number;
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, unknown> | 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;
workspaceId: number;
}>;
Unmutes a thread. You will start to see notifications in your inbox again when new comments are added.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The thread ID. |
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 | null;
commentCount: number;
content: string;
creator: number;
creatorName?: string | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
groups?: string[] | null;
id: string;
inInbox?: boolean | null;
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;
creator: number;
creatorName: string;
deleted: boolean;
deletedBy?: number | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
groups?: string[] | null;
id: string;
lastEdited?: Date | null;
objIndex: number;
posted: Date;
reactions?: Record<string, number[]> | null;
recipients?: number[] | null;
systemMessage?: unknown;
threadId: string;
toEmails?: string[] | null;
version: number;
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, unknown> | 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;
workspaceId: number;
}>
The updated thread object.
unpinThread()
unpinThread(id: string): Promise<{
status: "ok";
}>;
Unpins a thread.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The thread ID. |
Returns
Promise<{
status: "ok";
}>
unsaveThread()
unsaveThread(id: string): Promise<{
status: "ok";
}>;
Unsaves a thread (formerly "unstar").
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The thread ID. |
Returns
Promise<{
status: "ok";
}>
updateThread()
updateThread(args: {
content?: string | null;
id: string;
title?: string | null;
}): 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 | null;
commentCount: number;
content: string;
creator: number;
creatorName?: string | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
groups?: string[] | null;
id: string;
inInbox?: boolean | null;
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;
creator: number;
creatorName: string;
deleted: boolean;
deletedBy?: number | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
groups?: string[] | null;
id: string;
lastEdited?: Date | null;
objIndex: number;
posted: Date;
reactions?: Record<string, number[]> | null;
recipients?: number[] | null;
systemMessage?: unknown;
threadId: string;
toEmails?: string[] | null;
version: number;
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, unknown> | 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;
workspaceId: number;
}>;
Partial update of an existing thread.
Parameters
| Parameter | Type | Description |
|---|---|---|
args | { content?: string | null; id: string; title?: string | null; } | The arguments for updating a thread. |
args.content? | string | null | Optional new thread content. |
args.id | string | The thread ID. |
args.title? | string | null | Optional new thread title. |
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 | null;
commentCount: number;
content: string;
creator: number;
creatorName?: string | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
groups?: string[] | null;
id: string;
inInbox?: boolean | null;
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;
creator: number;
creatorName: string;
deleted: boolean;
deletedBy?: number | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
groups?: string[] | null;
id: string;
lastEdited?: Date | null;
objIndex: number;
posted: Date;
reactions?: Record<string, number[]> | null;
recipients?: number[] | null;
systemMessage?: unknown;
threadId: string;
toEmails?: string[] | null;
version: number;
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, unknown> | 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;
workspaceId: number;
}>
The updated thread object.