Skip to main content

chat

Creates, updates, deletes, gets or lists a chat resource.

Overview

Namechat
TypeResource
Idazure.communication_chat.chat

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringChat thread id. Required.
deletedOnstring (date-time)The timestamp when the chat thread was deleted. The timestamp is in RFC3339 format: yyyy-MM-ddTHH:mm:ssZ.
lastMessageReceivedOnstring (date-time)The timestamp when the last message arrived at the server. The timestamp is in RFC3339 format: yyyy-MM-ddTHH:mm:ssZ.
topicstringChat thread topic. Required.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
list_chat_threadsselectendpointmaxPageSize, startTimeGets the list of chat threads of a user. Gets the list of chat threads of a user.
create_chat_threadinsertendpoint, topicrepeatability-request-idCreates a chat thread. Creates a chat thread.
delete_chat_threaddeletechat_thread_id, endpointDeletes a thread. Deletes a thread.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
chat_thread_idstringId of the thread to be deleted. Required.
endpointstringThe service endpoint host (no scheme). (default: )
maxPageSizeintegerThe maximum number of chat threads returned per page. Default value is None.
repeatability-request-idstringIf specified, the client directs that the request is repeatable; that is, that the client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate response without the server executing the request multiple times. The value of the Repeatability-Request-Id is an opaque string representing a client-generated, globally unique for all time, identifier for the request. It is recommended to use version 4 (random) UUIDs. Default value is None.
startTimestring (date-time)The earliest point in time to get chat threads up to. The timestamp should be in RFC3339 format: yyyy-MM-ddTHH:mm:ssZ. Default value is None.

SELECT examples

Gets the list of chat threads of a user. Gets the list of chat threads of a user.

SELECT
id,
deletedOn,
lastMessageReceivedOn,
topic
FROM azure.communication_chat.chat
WHERE endpoint = '{{ endpoint }}' -- required
AND maxPageSize = '{{ maxPageSize }}'
AND startTime = '{{ startTime }}'
;

INSERT examples

Creates a chat thread. Creates a chat thread.

INSERT INTO azure.communication_chat.chat (
topic,
participants,
endpoint,
repeatability-request-id
)
SELECT
'{{ topic }}' /* required */,
'{{ participants }}',
'{{ endpoint }}',
'{{ repeatability-request-id }}'
RETURNING
chatThread,
invalidParticipants
;

DELETE examples

Deletes a thread. Deletes a thread.

DELETE FROM azure.communication_chat.chat
WHERE chat_thread_id = '{{ chat_thread_id }}' --required
AND endpoint = '{{ endpoint }}' --required
;