ConversationMessagesClient
Client for /api/v1/conversation_messages/. The SDK auto-generates the
message id on createMessage when the caller doesn't supply one.
Extends
BaseClient
Constructors
Constructor
new ConversationMessagesClient(config: ClientConfig): ConversationMessagesClient;
Parameters
| Parameter | Type |
|---|---|
config | ClientConfig |
Returns
ConversationMessagesClient
Inherited from
BaseClient.constructor
Properties
| Property | Modifier | Type |
|---|---|---|
apiToken | readonly | string |
baseUrl? | readonly | string |
customFetch? | readonly | CustomFetch |
defaultVersion | readonly | "v1" |
Methods
createMessage()
createMessage(args: CreateConversationMessageArgs): 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;
content: string;
conversationId: string;
creator: number;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
id: string;
isDeleted?: boolean | null;
lastEdited?: Date | null;
objIndex?: number | null;
posted: Date;
reactions?: Record<string, number[]> | null;
systemMessage?: unknown;
url: string;
version?: number | null;
workspaceId: number;
}>;
Creates a new message in a conversation. id is auto-generated if not
supplied.
Parameters
| Parameter | Type | Description |
|---|---|---|
args | CreateConversationMessageArgs | The arguments for creating a message. |
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;
content: string;
conversationId: string;
creator: number;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
id: string;
isDeleted?: boolean | null;
lastEdited?: Date | null;
objIndex?: number | null;
posted: Date;
reactions?: Record<string, number[]> | null;
systemMessage?: unknown;
url: string;
version?: number | null;
workspaceId: number;
}>
The created message object.
Example
const message = await api.conversationMessages.createMessage({
conversationId: '7YpL3oZ4kZ9vP7Q1tR2sX42',
content: 'Thanks for the update!',
})
deleteMessage()
deleteMessage(id: string): Promise<{
status: "ok";
}>;
Permanently deletes a conversation message.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The message ID. |
Returns
Promise<{
status: "ok";
}>
Example
await api.conversationMessages.deleteMessage('7YpL3oZ4kZ9vP7Q1tR2sX43')
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
getMessage()
getMessage(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;
content: string;
conversationId: string;
creator: number;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
id: string;
isDeleted?: boolean | null;
lastEdited?: Date | null;
objIndex?: number | null;
posted: Date;
reactions?: Record<string, number[]> | null;
systemMessage?: unknown;
url: string;
version?: number | null;
workspaceId: number;
}>;
Gets a single conversation message by id.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The message 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;
content: string;
conversationId: string;
creator: number;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
id: string;
isDeleted?: boolean | null;
lastEdited?: Date | null;
objIndex?: number | null;
posted: Date;
reactions?: Record<string, number[]> | null;
systemMessage?: unknown;
url: string;
version?: number | null;
workspaceId: number;
}>
The conversation message object.
Example
const message = await api.conversationMessages.getMessage('7YpL3oZ4kZ9vP7Q1tR2sX43')
getMessages()
getMessages(args: GetConversationMessagesArgs): 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;
content: string;
conversationId: string;
creator: number;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
id: string;
isDeleted?: boolean | null;
lastEdited?: Date | null;
objIndex?: number | null;
posted: Date;
reactions?: Record<string, number[]> | null;
systemMessage?: unknown;
url: string;
version?: number | null;
workspaceId: number;
}[]>;
Gets all messages in a conversation.
Parameters
| Parameter | Type | Description |
|---|---|---|
args | GetConversationMessagesArgs | The arguments for getting messages. |
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;
content: string;
conversationId: string;
creator: number;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
id: string;
isDeleted?: boolean | null;
lastEdited?: Date | null;
objIndex?: number | null;
posted: Date;
reactions?: Record<string, number[]> | null;
systemMessage?: unknown;
url: string;
version?: number | null;
workspaceId: number;
}[]>
An array of message objects.
Example
const messages = await api.conversationMessages.getMessages({
conversationId: '7YpL3oZ4kZ9vP7Q1tR2sX42',
newerThan: new Date('2024-01-01'),
})
updateMessage()
updateMessage(args: UpdateConversationMessageArgs): 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;
content: string;
conversationId: string;
creator: number;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
id: string;
isDeleted?: boolean | null;
lastEdited?: Date | null;
objIndex?: number | null;
posted: Date;
reactions?: Record<string, number[]> | null;
systemMessage?: unknown;
url: string;
version?: number | null;
workspaceId: number;
}>;
Updates a conversation message.
Parameters
| Parameter | Type | Description |
|---|---|---|
args | UpdateConversationMessageArgs | The arguments for updating a message. |
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;
content: string;
conversationId: string;
creator: number;
directGroupMentions?: string[] | null;
directMentions?: number[] | null;
id: string;
isDeleted?: boolean | null;
lastEdited?: Date | null;
objIndex?: number | null;
posted: Date;
reactions?: Record<string, number[]> | null;
systemMessage?: unknown;
url: string;
version?: number | null;
workspaceId: number;
}>
The updated message object.
Example
const message = await api.conversationMessages.updateMessage({
id: '7YpL3oZ4kZ9vP7Q1tR2sX43',
content: 'Updated message content',
})