ChatThreadClient class

The client to do chat operations

Constructors

ChatThreadClient(string, string, CommunicationTokenCredential, ChatThreadClientOptions)

Properties

threadId

Thread ID of the ChatThreadClient

Methods

addParticipants(AddParticipantsRequest, OperationOptions)

Adds the details of chat participants belonging to the thread identified by threadId.

deleteMessage(string, OperationOptions)

Deletes a message identified by threadId and messageId

getMessage(string, OperationOptions)

Gets a chat message identified by messageId. Returns the specific message.

getProperties(OperationOptions)

Gets a chat thread. Returns the chat thread.

listMessages(RestListMessagesOptions)

Gets a list of message from a thread identified by threadId. Returns the list of the messages.

listParticipants(RestListParticipantsOptions)

Gets the participants of the thread identified by threadId. Returns the lists of the participants.

listReadReceipts(RestListReadReceiptsOptions)

Gets a list of read receipt from a thread identified by threadId. Returns the list of the messages.

removeParticipant(CommunicationIdentifier, OperationOptions)

Removes participant from the thread identified by threadId.

sendMessage(SendMessageRequest, SendMessageOptions)

Sends a chat message to a thread identified by threadId. Returns the id of the created message.

sendReadReceipt(SendReadReceiptRequest, OperationOptions)

Sends a read receipt to the thread identified by threadId.

sendTypingNotification(SendTypingNotificationOptions)

Sends a typing notification to the thread. Doesn't attempt to send if the time since last notification is smaller than the minimum typing interval

updateMessage(string, UpdateMessageOptions)

Updates a message identified by threadId and messageId

updateTopic(string, UpdateTopicOptions)

Updates a thread's topic.

Constructor Details

ChatThreadClient(string, string, CommunicationTokenCredential, ChatThreadClientOptions)

new ChatThreadClient(endpoint: string, threadId: string, credential: CommunicationTokenCredential, options?: ChatThreadClientOptions)

Parameters

endpoint

string

threadId

string

Property Details

threadId

Thread ID of the ChatThreadClient

threadId: string

Property Value

string

Method Details

addParticipants(AddParticipantsRequest, OperationOptions)

Adds the details of chat participants belonging to the thread identified by threadId.

function addParticipants(request: AddParticipantsRequest, options?: OperationOptions): Promise<AddChatParticipantsResult>

Parameters

request
AddParticipantsRequest

Thread participants' details to add in the thread roster

options
OperationOptions

Operation options.

Returns

deleteMessage(string, OperationOptions)

Deletes a message identified by threadId and messageId

function deleteMessage(messageId: string, options?: OperationOptions): Promise<void>

Parameters

messageId

string

The message id of the message.

options
OperationOptions

Operation options.

Returns

Promise<void>

getMessage(string, OperationOptions)

Gets a chat message identified by messageId. Returns the specific message.

function getMessage(messageId: string, options?: OperationOptions): Promise<ChatMessage>

Parameters

messageId

string

The message id of the message.

options
OperationOptions

Operation options.

Returns

Promise<ChatMessage>

getProperties(OperationOptions)

Gets a chat thread. Returns the chat thread.

function getProperties(options?: OperationOptions): Promise<ChatThreadProperties>

Parameters

options
OperationOptions

Operation options.

Returns

listMessages(RestListMessagesOptions)

Gets a list of message from a thread identified by threadId. Returns the list of the messages.

function listMessages(options?: RestListMessagesOptions): PagedAsyncIterableIterator<ChatMessage, ChatMessage[], PageSettings>

Parameters

options
RestListMessagesOptions

Get messages options.

Returns

listParticipants(RestListParticipantsOptions)

Gets the participants of the thread identified by threadId. Returns the lists of the participants.

function listParticipants(options?: RestListParticipantsOptions): PagedAsyncIterableIterator<ChatParticipant, ChatParticipant[], PageSettings>

Parameters

options
RestListParticipantsOptions

Operation options.

Returns

listReadReceipts(RestListReadReceiptsOptions)

Gets a list of read receipt from a thread identified by threadId. Returns the list of the messages.

function listReadReceipts(options?: RestListReadReceiptsOptions): PagedAsyncIterableIterator<ChatMessageReadReceipt, ChatMessageReadReceipt[], PageSettings>

Parameters

options
RestListReadReceiptsOptions

Get messages options.

Returns

removeParticipant(CommunicationIdentifier, OperationOptions)

Removes participant from the thread identified by threadId.

function removeParticipant(participant: CommunicationIdentifier, options?: OperationOptions): Promise<void>

Parameters

participant
CommunicationIdentifier

Thread participant to remove from the thread roster

options
OperationOptions

Operation options.

Returns

Promise<void>

sendMessage(SendMessageRequest, SendMessageOptions)

Sends a chat message to a thread identified by threadId. Returns the id of the created message.

function sendMessage(request: SendMessageRequest, options?: SendMessageOptions): Promise<SendChatMessageResult>

Parameters

request
SendMessageRequest

Request for sending a message.

options
SendMessageOptions

Operation options.

Returns

sendReadReceipt(SendReadReceiptRequest, OperationOptions)

Sends a read receipt to the thread identified by threadId.

function sendReadReceipt(request: SendReadReceiptRequest, options?: OperationOptions): Promise<void>

Parameters

request
SendReadReceiptRequest

Request for sending a read receipt

options
OperationOptions

Operation options.

Returns

Promise<void>

sendTypingNotification(SendTypingNotificationOptions)

Sends a typing notification to the thread. Doesn't attempt to send if the time since last notification is smaller than the minimum typing interval

function sendTypingNotification(options?: SendTypingNotificationOptions): Promise<boolean>

Parameters

options
SendTypingNotificationOptions

Operation options

Returns

Promise<boolean>

True if the typing message notification could be sent, otherwise false.

updateMessage(string, UpdateMessageOptions)

Updates a message identified by threadId and messageId

function updateMessage(messageId: string, options?: UpdateMessageOptions): Promise<void>

Parameters

messageId

string

The message id of the message.

options
UpdateMessageOptions

Operation options.

Returns

Promise<void>

updateTopic(string, UpdateTopicOptions)

Updates a thread's topic.

function updateTopic(topic: string, options?: UpdateTopicOptions): Promise<void>

Parameters

topic

string

The topic needs to be updated to.

options
UpdateTopicOptions

Operation options.

Returns

Promise<void>