ConversationsClient
Client for /api/v1/conversations/. getOrCreate requires an id (the
SDK auto-generates one for new conversations); the backend dedupes on
userIds, so an existing conversation will be returned with its own
already-assigned id and your generated one is silently dropped.
Extends
BaseClient
Constructors
Constructor
new ConversationsClient(config: ClientConfig): ConversationsClient;
Parameters
| Parameter | Type |
|---|---|
config | ClientConfig |
Returns
ConversationsClient
Inherited from
BaseClient.constructor
Properties
| Property | Modifier | Type |
|---|---|---|
apiToken | readonly | string |
baseUrl? | readonly | string |
customFetch? | readonly | CustomFetch |
defaultVersion | readonly | "v1" |
Methods
addUser()
addUser(args: AddConversationUserArgs): Promise<{
archived: boolean;
created: Date;
creator: number;
id: string;
lastActive: Date;
lastMessage?: | {
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;
content: string;
conversationId: string;
creator: number;
deleted?: boolean | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
id: string;
lastEdited?: Date | null;
objIndex?: number | null;
posted: Date;
reactions?: Record<string, number[]> | null;
systemMessage?: unknown;
version?: number | null;
workspaceId?: number | null;
}
| null;
lastObjIndex: number;
messageCount?: number | null;
mutedUntil?: Date | null;
private?: boolean | null;
snippet: string;
snippetCreators: number[];
title?: string | null;
url: string;
userIds: number[];
workspaceId: number;
}>;
Adds a user to a conversation.
Parameters
| Parameter | Type | Description |
|---|---|---|
args | AddConversationUserArgs | The arguments for adding a user. |
Returns
Promise<{
archived: boolean;
created: Date;
creator: number;
id: string;
lastActive: Date;
lastMessage?: | {
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;
content: string;
conversationId: string;
creator: number;
deleted?: boolean | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
id: string;
lastEdited?: Date | null;
objIndex?: number | null;
posted: Date;
reactions?: Record<string, number[]> | null;
systemMessage?: unknown;
version?: number | null;
workspaceId?: number | null;
}
| null;
lastObjIndex: number;
messageCount?: number | null;
mutedUntil?: Date | null;
private?: boolean | null;
snippet: string;
snippetCreators: number[];
title?: string | null;
url: string;
userIds: number[];
workspaceId: number;
}>
The updated conversation object.
addUsers()
addUsers(args: AddConversationUsersArgs): Promise<{
archived: boolean;
created: Date;
creator: number;
id: string;
lastActive: Date;
lastMessage?: | {
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;
content: string;
conversationId: string;
creator: number;
deleted?: boolean | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
id: string;
lastEdited?: Date | null;
objIndex?: number | null;
posted: Date;
reactions?: Record<string, number[]> | null;
systemMessage?: unknown;
version?: number | null;
workspaceId?: number | null;
}
| null;
lastObjIndex: number;
messageCount?: number | null;
mutedUntil?: Date | null;
private?: boolean | null;
snippet: string;
snippetCreators: number[];
title?: string | null;
url: string;
userIds: number[];
workspaceId: number;
}>;
Adds multiple users to a conversation.
Parameters
| Parameter | Type | Description |
|---|---|---|
args | AddConversationUsersArgs | The arguments for adding users. |
Returns
Promise<{
archived: boolean;
created: Date;
creator: number;
id: string;
lastActive: Date;
lastMessage?: | {
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;
content: string;
conversationId: string;
creator: number;
deleted?: boolean | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
id: string;
lastEdited?: Date | null;
objIndex?: number | null;
posted: Date;
reactions?: Record<string, number[]> | null;
systemMessage?: unknown;
version?: number | null;
workspaceId?: number | null;
}
| null;
lastObjIndex: number;
messageCount?: number | null;
mutedUntil?: Date | null;
private?: boolean | null;
snippet: string;
snippetCreators: number[];
title?: string | null;
url: string;
userIds: number[];
workspaceId: number;
}>
The updated conversation object.
Example
await api.conversations.addUsers({ id: '7YpL3oZ4kZ9vP7Q1tR2sX42', userIds: [101, 202] })
archiveConversation()
archiveConversation(id: string): Promise<{
archived: boolean;
created: Date;
creator: number;
id: string;
lastActive: Date;
lastMessage?: | {
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;
content: string;
conversationId: string;
creator: number;
deleted?: boolean | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
id: string;
lastEdited?: Date | null;
objIndex?: number | null;
posted: Date;
reactions?: Record<string, number[]> | null;
systemMessage?: unknown;
version?: number | null;
workspaceId?: number | null;
}
| null;
lastObjIndex: number;
messageCount?: number | null;
mutedUntil?: Date | null;
private?: boolean | null;
snippet: string;
snippetCreators: number[];
title?: string | null;
url: string;
userIds: number[];
workspaceId: number;
}>;
Archives a conversation.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The conversation ID. |
Returns
Promise<{
archived: boolean;
created: Date;
creator: number;
id: string;
lastActive: Date;
lastMessage?: | {
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;
content: string;
conversationId: string;
creator: number;
deleted?: boolean | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
id: string;
lastEdited?: Date | null;
objIndex?: number | null;
posted: Date;
reactions?: Record<string, number[]> | null;
systemMessage?: unknown;
version?: number | null;
workspaceId?: number | null;
}
| null;
lastObjIndex: number;
messageCount?: number | null;
mutedUntil?: Date | null;
private?: boolean | null;
snippet: string;
snippetCreators: number[];
title?: string | null;
url: string;
userIds: number[];
workspaceId: number;
}>
The updated conversation object.
clearUnread()
clearUnread(workspaceId: number): Promise<{
status: "ok";
}>;
Clears all unread conversations for a workspace.
Parameters
| Parameter | Type | Description |
|---|---|---|
workspaceId | number | The workspace 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
getConversation()
getConversation(id: string): Promise<{
archived: boolean;
created: Date;
creator: number;
id: string;
lastActive: Date;
lastMessage?: | {
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;
content: string;
conversationId: string;
creator: number;
deleted?: boolean | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
id: string;
lastEdited?: Date | null;
objIndex?: number | null;
posted: Date;
reactions?: Record<string, number[]> | null;
systemMessage?: unknown;
version?: number | null;
workspaceId?: number | null;
}
| null;
lastObjIndex: number;
messageCount?: number | null;
mutedUntil?: Date | null;
private?: boolean | null;
snippet: string;
snippetCreators: number[];
title?: string | null;
url: string;
userIds: number[];
workspaceId: number;
}>;
Gets a single conversation object by id.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The conversation ID. |
Returns
Promise<{
archived: boolean;
created: Date;
creator: number;
id: string;
lastActive: Date;
lastMessage?: | {
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;
content: string;
conversationId: string;
creator: number;
deleted?: boolean | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
id: string;
lastEdited?: Date | null;
objIndex?: number | null;
posted: Date;
reactions?: Record<string, number[]> | null;
systemMessage?: unknown;
version?: number | null;
workspaceId?: number | null;
}
| null;
lastObjIndex: number;
messageCount?: number | null;
mutedUntil?: Date | null;
private?: boolean | null;
snippet: string;
snippetCreators: number[];
title?: string | null;
url: string;
userIds: number[];
workspaceId: number;
}>
The conversation object.
getConversations()
getConversations(args: {
archived?: boolean | null;
workspaceId: number;
}): Promise<{
archived: boolean;
created: Date;
creator: number;
id: string;
lastActive: Date;
lastMessage?: | {
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;
content: string;
conversationId: string;
creator: number;
deleted?: boolean | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
id: string;
lastEdited?: Date | null;
objIndex?: number | null;
posted: Date;
reactions?: Record<string, number[]> | null;
systemMessage?: unknown;
version?: number | null;
workspaceId?: number | null;
}
| null;
lastObjIndex: number;
messageCount?: number | null;
mutedUntil?: Date | null;
private?: boolean | null;
snippet: string;
snippetCreators: number[];
title?: string | null;
url: string;
userIds: number[];
workspaceId: number;
}[]>;
Gets all conversations for a workspace.
Parameters
| Parameter | Type | Description |
|---|---|---|
args | { archived?: boolean | null; workspaceId: number; } | The arguments for getting conversations. |
args.archived? | boolean | null | Optional flag to include archived conversations. |
args.workspaceId | number | The workspace ID. |
Returns
Promise<{
archived: boolean;
created: Date;
creator: number;
id: string;
lastActive: Date;
lastMessage?: | {
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;
content: string;
conversationId: string;
creator: number;
deleted?: boolean | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
id: string;
lastEdited?: Date | null;
objIndex?: number | null;
posted: Date;
reactions?: Record<string, number[]> | null;
systemMessage?: unknown;
version?: number | null;
workspaceId?: number | null;
}
| null;
lastObjIndex: number;
messageCount?: number | null;
mutedUntil?: Date | null;
private?: boolean | null;
snippet: string;
snippetCreators: number[];
title?: string | null;
url: string;
userIds: number[];
workspaceId: number;
}[]>
An array of conversation objects.
Example
const conversations = await api.conversations.getConversations({ workspaceId: 123 })
conversations.forEach(c => console.log(c.title))
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
getOrCreateConversation()
getOrCreateConversation(args: {
id?: string;
userIds: number[];
workspaceId: number;
}): Promise<{
archived: boolean;
created: Date;
creator: number;
id: string;
lastActive: Date;
lastMessage?: | {
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;
content: string;
conversationId: string;
creator: number;
deleted?: boolean | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
id: string;
lastEdited?: Date | null;
objIndex?: number | null;
posted: Date;
reactions?: Record<string, number[]> | null;
systemMessage?: unknown;
version?: number | null;
workspaceId?: number | null;
}
| null;
lastObjIndex: number;
messageCount?: number | null;
mutedUntil?: Date | null;
private?: boolean | null;
snippet: string;
snippetCreators: number[];
title?: string | null;
url: string;
userIds: number[];
workspaceId: number;
}>;
Gets an existing 1:1 / group conversation with userIds, or creates a
new one. id is auto-generated if not supplied — on dedupe, the
backend returns the existing conversation's id instead.
Parameters
| Parameter | Type | Description |
|---|---|---|
args | { id?: string; userIds: number[]; workspaceId: number; } | The arguments for getting or creating a conversation. |
args.id? | string | - |
args.userIds | number[] | Array of user IDs to include in the conversation. |
args.workspaceId | number | The workspace ID. |
Returns
Promise<{
archived: boolean;
created: Date;
creator: number;
id: string;
lastActive: Date;
lastMessage?: | {
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;
content: string;
conversationId: string;
creator: number;
deleted?: boolean | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
id: string;
lastEdited?: Date | null;
objIndex?: number | null;
posted: Date;
reactions?: Record<string, number[]> | null;
systemMessage?: unknown;
version?: number | null;
workspaceId?: number | null;
}
| null;
lastObjIndex: number;
messageCount?: number | null;
mutedUntil?: Date | null;
private?: boolean | null;
snippet: string;
snippetCreators: number[];
title?: string | null;
url: string;
userIds: number[];
workspaceId: number;
}>
The conversation object (existing or newly created).
Example
const conversation = await api.conversations.getOrCreateConversation({
workspaceId: 123,
userIds: [101, 202, 303],
})
getUnread()
getUnread(workspaceId: number): Promise<{
data: {
conversationId: string;
directMention: boolean;
objIndex: number;
}[];
version: number;
}>;
Returns unread conversations for a workspace, paired with the unread version counter.
Parameters
| Parameter | Type | Description |
|---|---|---|
workspaceId | number | The workspace ID. |
Returns
Promise<{
data: {
conversationId: string;
directMention: boolean;
objIndex: number;
}[];
version: number;
}>
Object containing the array of unread conversation references and a version counter.
markRead()
markRead(args: {
id: string;
messageId?: string;
objIndex?: number;
}): Promise<{
status: "ok";
}>;
Marks a conversation as read.
Parameters
| Parameter | Type | Description |
|---|---|---|
args | { id: string; messageId?: string; objIndex?: number; } | The arguments for marking as read. |
args.id | string | The conversation ID. |
args.messageId? | string | Optional message ID to mark as last read. |
args.objIndex? | number | Optional index of the message to mark as last read. |
Returns
Promise<{
status: "ok";
}>
markUnread()
markUnread(args: {
id: string;
messageId?: string;
objIndex?: number;
}): Promise<{
status: "ok";
}>;
Marks a conversation as unread.
Parameters
| Parameter | Type | Description |
|---|---|---|
args | { id: string; messageId?: string; objIndex?: number; } | The arguments for marking as unread. |
args.id | string | The conversation ID. |
args.messageId? | string | Optional message ID to mark as last unread. |
args.objIndex? | number | Optional index of the message to mark as last unread. |
Returns
Promise<{
status: "ok";
}>
muteConversation()
muteConversation(args: MuteConversationArgs): Promise<{
archived: boolean;
created: Date;
creator: number;
id: string;
lastActive: Date;
lastMessage?: | {
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;
content: string;
conversationId: string;
creator: number;
deleted?: boolean | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
id: string;
lastEdited?: Date | null;
objIndex?: number | null;
posted: Date;
reactions?: Record<string, number[]> | null;
systemMessage?: unknown;
version?: number | null;
workspaceId?: number | null;
}
| null;
lastObjIndex: number;
messageCount?: number | null;
mutedUntil?: Date | null;
private?: boolean | null;
snippet: string;
snippetCreators: number[];
title?: string | null;
url: string;
userIds: number[];
workspaceId: number;
}>;
Mutes a conversation for a specified number of minutes. The user will receive no notifications from this conversation during that period.
Parameters
| Parameter | Type | Description |
|---|---|---|
args | MuteConversationArgs | The arguments for muting a conversation. |
Returns
Promise<{
archived: boolean;
created: Date;
creator: number;
id: string;
lastActive: Date;
lastMessage?: | {
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;
content: string;
conversationId: string;
creator: number;
deleted?: boolean | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
id: string;
lastEdited?: Date | null;
objIndex?: number | null;
posted: Date;
reactions?: Record<string, number[]> | null;
systemMessage?: unknown;
version?: number | null;
workspaceId?: number | null;
}
| null;
lastObjIndex: number;
messageCount?: number | null;
mutedUntil?: Date | null;
private?: boolean | null;
snippet: string;
snippetCreators: number[];
title?: string | null;
url: string;
userIds: number[];
workspaceId: number;
}>
The updated conversation object.
Example
const conversation = await api.conversations.muteConversation({ id: '7YpL3oZ4kZ9vP7Q1tR2sX42', minutes: 30 })
removeUser()
removeUser(args: RemoveConversationUserArgs): Promise<{
archived: boolean;
created: Date;
creator: number;
id: string;
lastActive: Date;
lastMessage?: | {
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;
content: string;
conversationId: string;
creator: number;
deleted?: boolean | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
id: string;
lastEdited?: Date | null;
objIndex?: number | null;
posted: Date;
reactions?: Record<string, number[]> | null;
systemMessage?: unknown;
version?: number | null;
workspaceId?: number | null;
}
| null;
lastObjIndex: number;
messageCount?: number | null;
mutedUntil?: Date | null;
private?: boolean | null;
snippet: string;
snippetCreators: number[];
title?: string | null;
url: string;
userIds: number[];
workspaceId: number;
}>;
Removes a user from a conversation.
Parameters
| Parameter | Type | Description |
|---|---|---|
args | RemoveConversationUserArgs | The arguments for removing a user. |
Returns
Promise<{
archived: boolean;
created: Date;
creator: number;
id: string;
lastActive: Date;
lastMessage?: | {
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;
content: string;
conversationId: string;
creator: number;
deleted?: boolean | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
id: string;
lastEdited?: Date | null;
objIndex?: number | null;
posted: Date;
reactions?: Record<string, number[]> | null;
systemMessage?: unknown;
version?: number | null;
workspaceId?: number | null;
}
| null;
lastObjIndex: number;
messageCount?: number | null;
mutedUntil?: Date | null;
private?: boolean | null;
snippet: string;
snippetCreators: number[];
title?: string | null;
url: string;
userIds: number[];
workspaceId: number;
}>
The updated conversation object.
removeUsers()
removeUsers(args: RemoveConversationUsersArgs): Promise<{
archived: boolean;
created: Date;
creator: number;
id: string;
lastActive: Date;
lastMessage?: | {
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;
content: string;
conversationId: string;
creator: number;
deleted?: boolean | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
id: string;
lastEdited?: Date | null;
objIndex?: number | null;
posted: Date;
reactions?: Record<string, number[]> | null;
systemMessage?: unknown;
version?: number | null;
workspaceId?: number | null;
}
| null;
lastObjIndex: number;
messageCount?: number | null;
mutedUntil?: Date | null;
private?: boolean | null;
snippet: string;
snippetCreators: number[];
title?: string | null;
url: string;
userIds: number[];
workspaceId: number;
}>;
Removes multiple users from a conversation.
Parameters
| Parameter | Type | Description |
|---|---|---|
args | RemoveConversationUsersArgs | The arguments for removing users. |
Returns
Promise<{
archived: boolean;
created: Date;
creator: number;
id: string;
lastActive: Date;
lastMessage?: | {
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;
content: string;
conversationId: string;
creator: number;
deleted?: boolean | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
id: string;
lastEdited?: Date | null;
objIndex?: number | null;
posted: Date;
reactions?: Record<string, number[]> | null;
systemMessage?: unknown;
version?: number | null;
workspaceId?: number | null;
}
| null;
lastObjIndex: number;
messageCount?: number | null;
mutedUntil?: Date | null;
private?: boolean | null;
snippet: string;
snippetCreators: number[];
title?: string | null;
url: string;
userIds: number[];
workspaceId: number;
}>
The updated conversation object.
unarchiveConversation()
unarchiveConversation(id: string): Promise<{
archived: boolean;
created: Date;
creator: number;
id: string;
lastActive: Date;
lastMessage?: | {
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;
content: string;
conversationId: string;
creator: number;
deleted?: boolean | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
id: string;
lastEdited?: Date | null;
objIndex?: number | null;
posted: Date;
reactions?: Record<string, number[]> | null;
systemMessage?: unknown;
version?: number | null;
workspaceId?: number | null;
}
| null;
lastObjIndex: number;
messageCount?: number | null;
mutedUntil?: Date | null;
private?: boolean | null;
snippet: string;
snippetCreators: number[];
title?: string | null;
url: string;
userIds: number[];
workspaceId: number;
}>;
Unarchives a conversation.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The conversation ID. |
Returns
Promise<{
archived: boolean;
created: Date;
creator: number;
id: string;
lastActive: Date;
lastMessage?: | {
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;
content: string;
conversationId: string;
creator: number;
deleted?: boolean | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
id: string;
lastEdited?: Date | null;
objIndex?: number | null;
posted: Date;
reactions?: Record<string, number[]> | null;
systemMessage?: unknown;
version?: number | null;
workspaceId?: number | null;
}
| null;
lastObjIndex: number;
messageCount?: number | null;
mutedUntil?: Date | null;
private?: boolean | null;
snippet: string;
snippetCreators: number[];
title?: string | null;
url: string;
userIds: number[];
workspaceId: number;
}>
The updated conversation object.
unmuteConversation()
unmuteConversation(id: string): Promise<{
archived: boolean;
created: Date;
creator: number;
id: string;
lastActive: Date;
lastMessage?: | {
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;
content: string;
conversationId: string;
creator: number;
deleted?: boolean | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
id: string;
lastEdited?: Date | null;
objIndex?: number | null;
posted: Date;
reactions?: Record<string, number[]> | null;
systemMessage?: unknown;
version?: number | null;
workspaceId?: number | null;
}
| null;
lastObjIndex: number;
messageCount?: number | null;
mutedUntil?: Date | null;
private?: boolean | null;
snippet: string;
snippetCreators: number[];
title?: string | null;
url: string;
userIds: number[];
workspaceId: number;
}>;
Unmutes a conversation.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The conversation ID. |
Returns
Promise<{
archived: boolean;
created: Date;
creator: number;
id: string;
lastActive: Date;
lastMessage?: | {
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;
content: string;
conversationId: string;
creator: number;
deleted?: boolean | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
id: string;
lastEdited?: Date | null;
objIndex?: number | null;
posted: Date;
reactions?: Record<string, number[]> | null;
systemMessage?: unknown;
version?: number | null;
workspaceId?: number | null;
}
| null;
lastObjIndex: number;
messageCount?: number | null;
mutedUntil?: Date | null;
private?: boolean | null;
snippet: string;
snippetCreators: number[];
title?: string | null;
url: string;
userIds: number[];
workspaceId: number;
}>
The updated conversation object.
updateConversation()
updateConversation(args: UpdateConversationArgs): Promise<{
archived: boolean;
created: Date;
creator: number;
id: string;
lastActive: Date;
lastMessage?: | {
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;
content: string;
conversationId: string;
creator: number;
deleted?: boolean | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
id: string;
lastEdited?: Date | null;
objIndex?: number | null;
posted: Date;
reactions?: Record<string, number[]> | null;
systemMessage?: unknown;
version?: number | null;
workspaceId?: number | null;
}
| null;
lastObjIndex: number;
messageCount?: number | null;
mutedUntil?: Date | null;
private?: boolean | null;
snippet: string;
snippetCreators: number[];
title?: string | null;
url: string;
userIds: number[];
workspaceId: number;
}>;
Updates a conversation's title.
Parameters
| Parameter | Type | Description |
|---|---|---|
args | UpdateConversationArgs | The arguments for updating a conversation. |
Returns
Promise<{
archived: boolean;
created: Date;
creator: number;
id: string;
lastActive: Date;
lastMessage?: | {
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;
content: string;
conversationId: string;
creator: number;
deleted?: boolean | null;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
id: string;
lastEdited?: Date | null;
objIndex?: number | null;
posted: Date;
reactions?: Record<string, number[]> | null;
systemMessage?: unknown;
version?: number | null;
workspaceId?: number | null;
}
| null;
lastObjIndex: number;
messageCount?: number | null;
mutedUntil?: Date | null;
private?: boolean | null;
snippet: string;
snippetCreators: number[];
title?: string | null;
url: string;
userIds: number[];
workspaceId: number;
}>
The updated conversation object.
Example
const conversation = await api.conversations.updateConversation({
id: '7YpL3oZ4kZ9vP7Q1tR2sX42',
title: 'New Title',
})