chat_thread
Creates, updates, deletes, gets or lists a chat_thread resource.
Overview
| Name | chat_thread |
| Type | Resource |
| Id | azure.communication_chat.chat_thread |
Fields
The following fields are returned by SELECT queries:
- get_chat_message
- list_chat_read_receipts
| Name | Datatype | Description |
|---|---|---|
id | string | The id of the chat message. This id is server generated. Required. |
content | object | Content of a chat message. |
createdOn | string (date-time) | The timestamp when the chat message arrived at the server. The timestamp is in RFC3339 format: yyyy-MM-ddTHH:mm:ssZ. Required. |
deletedOn | string (date-time) | The timestamp (if applicable) when the message was deleted. The timestamp is in RFC3339 format: yyyy-MM-ddTHH:mm:ssZ. |
editedOn | string (date-time) | The last timestamp (if applicable) when the message was edited. The timestamp is in RFC3339 format: yyyy-MM-ddTHH:mm:ssZ. |
metadata | object | Message metadata. |
senderCommunicationIdentifier | object | Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model is polymorphic: Apart from kind and rawId, at most one further property may be set which must match the kind enum value. |
senderDisplayName | string | The display name of the chat message sender. This property is used to populate sender name for push notifications. |
sequenceId | string | Sequence of the chat message in the conversation. Required. |
type | string | The chat message type. Required. Known values are: "text", "html", "topicUpdated", "participantAdded", and "participantRemoved". |
version | string | Version of the chat message. Required. |
| Name | Datatype | Description |
|---|---|---|
chatMessageId | string | Id of the chat message that has been read. This id is generated by the server. Required. |
readOn | string (date-time) | The time at which the message was read. The timestamp is in RFC3339 format: yyyy-MM-ddTHH:mm:ssZ. Required. |
senderCommunicationIdentifier | object | Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model is polymorphic: Apart from kind and rawId, at most one further property may be set which must match the kind enum value. Required. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_chat_message | select | chat_thread_id, chat_message_id, endpoint | Gets a message by id. Gets a message by id. | |
list_chat_read_receipts | select | chat_thread_id, endpoint | maxPageSize, skip | Gets chat message read receipts for a thread. Gets chat message read receipts for a thread. |
update_chat_thread_properties | update | chat_thread_id, endpoint | Updates a thread's properties. Updates a thread's properties. | |
get_chat_thread_properties | exec | chat_thread_id, endpoint | Gets a chat thread's properties. Gets a chat thread's properties. | |
send_chat_read_receipt | exec | chat_thread_id, endpoint, chatMessageId | Sends a read receipt event to a thread, on behalf of a user. Sends a read receipt event to a thread, on behalf of a user. | |
list_chat_messages | exec | chat_thread_id, endpoint | maxPageSize, startTime | Gets a list of messages from a thread. Gets a list of messages from a thread. |
send_chat_message | exec | chat_thread_id, endpoint, content | Sends a message to a thread. Sends a message to a thread. | |
list_chat_participants | exec | chat_thread_id, endpoint | maxPageSize, skip | Gets the participants of a thread. Gets the participants of a thread. |
update_chat_message | exec | chat_thread_id, chat_message_id, endpoint | Updates a message. Updates a message. | |
delete_chat_message | exec | chat_thread_id, chat_message_id, endpoint | Deletes a message. Deletes a message. | |
remove_chat_participant | exec | chat_thread_id, endpoint | Remove a participant from a thread. Remove a participant from a thread. | |
add_chat_participants | exec | chat_thread_id, endpoint, participants | Adds thread participants to a thread. If participants already exist, no change occurs. Adds thread participants to a thread. If participants already exist, no change occurs. | |
send_typing_notification | exec | chat_thread_id, endpoint | Posts a typing event to a thread, on behalf of a user. Posts a typing event to a thread, on behalf of a user. |
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.
| Name | Datatype | Description |
|---|---|---|
chat_message_id | string | The message id. Required. |
chat_thread_id | string | Id of the thread. Required. |
endpoint | string | The service endpoint host (no scheme). (default: ) |
maxPageSize | integer | The maximum number of participants to be returned per page. Default value is None. |
skip | integer | Skips participants up to a specified position in response. Default value is None. |
startTime | string (date-time) | The earliest point in time to get messages up to. The timestamp should be in RFC3339 format: yyyy-MM-ddTHH:mm:ssZ. Default value is None. |
SELECT examples
- get_chat_message
- list_chat_read_receipts
Gets a message by id. Gets a message by id.
SELECT
id,
content,
createdOn,
deletedOn,
editedOn,
metadata,
senderCommunicationIdentifier,
senderDisplayName,
sequenceId,
type,
version
FROM azure.communication_chat.chat_thread
WHERE chat_thread_id = '{{ chat_thread_id }}' -- required
AND chat_message_id = '{{ chat_message_id }}' -- required
AND endpoint = '{{ endpoint }}' -- required
;
Gets chat message read receipts for a thread. Gets chat message read receipts for a thread.
SELECT
chatMessageId,
readOn,
senderCommunicationIdentifier
FROM azure.communication_chat.chat_thread
WHERE chat_thread_id = '{{ chat_thread_id }}' -- required
AND endpoint = '{{ endpoint }}' -- required
AND maxPageSize = '{{ maxPageSize }}'
AND skip = '{{ skip }}'
;
UPDATE examples
- update_chat_thread_properties
Updates a thread's properties. Updates a thread's properties.
UPDATE azure.communication_chat.chat_thread
SET
topic = '{{ topic }}'
WHERE
chat_thread_id = '{{ chat_thread_id }}' --required
AND endpoint = '{{ endpoint }}' --required;
Lifecycle Methods
- get_chat_thread_properties
- send_chat_read_receipt
- list_chat_messages
- send_chat_message
- list_chat_participants
- update_chat_message
- delete_chat_message
- remove_chat_participant
- add_chat_participants
- send_typing_notification
Gets a chat thread's properties. Gets a chat thread's properties.
EXEC azure.communication_chat.chat_thread.get_chat_thread_properties
@chat_thread_id='{{ chat_thread_id }}' --required,
@endpoint='{{ endpoint }}' --required
;
Sends a read receipt event to a thread, on behalf of a user. Sends a read receipt event to a thread, on behalf of a user.
EXEC azure.communication_chat.chat_thread.send_chat_read_receipt
@chat_thread_id='{{ chat_thread_id }}' --required,
@endpoint='{{ endpoint }}' --required
@@json=
'{
"chatMessageId": "{{ chatMessageId }}"
}'
;
Gets a list of messages from a thread. Gets a list of messages from a thread.
EXEC azure.communication_chat.chat_thread.list_chat_messages
@chat_thread_id='{{ chat_thread_id }}' --required,
@endpoint='{{ endpoint }}' --required,
@maxPageSize='{{ maxPageSize }}',
@startTime='{{ startTime }}'
;
Sends a message to a thread. Sends a message to a thread.
EXEC azure.communication_chat.chat_thread.send_chat_message
@chat_thread_id='{{ chat_thread_id }}' --required,
@endpoint='{{ endpoint }}' --required
@@json=
'{
"content": "{{ content }}",
"senderDisplayName": "{{ senderDisplayName }}",
"type": "{{ type }}",
"metadata": "{{ metadata }}"
}'
;
Gets the participants of a thread. Gets the participants of a thread.
EXEC azure.communication_chat.chat_thread.list_chat_participants
@chat_thread_id='{{ chat_thread_id }}' --required,
@endpoint='{{ endpoint }}' --required,
@maxPageSize='{{ maxPageSize }}',
@skip='{{ skip }}'
;
Updates a message. Updates a message.
EXEC azure.communication_chat.chat_thread.update_chat_message
@chat_thread_id='{{ chat_thread_id }}' --required,
@chat_message_id='{{ chat_message_id }}' --required,
@endpoint='{{ endpoint }}' --required
@@json=
'{
"content": "{{ content }}",
"metadata": "{{ metadata }}"
}'
;
Deletes a message. Deletes a message.
EXEC azure.communication_chat.chat_thread.delete_chat_message
@chat_thread_id='{{ chat_thread_id }}' --required,
@chat_message_id='{{ chat_message_id }}' --required,
@endpoint='{{ endpoint }}' --required
;
Remove a participant from a thread. Remove a participant from a thread.
EXEC azure.communication_chat.chat_thread.remove_chat_participant
@chat_thread_id='{{ chat_thread_id }}' --required,
@endpoint='{{ endpoint }}' --required
@@json=
'{
"kind": "{{ kind }}",
"rawId": "{{ rawId }}",
"communicationUser": "{{ communicationUser }}",
"phoneNumber": "{{ phoneNumber }}",
"microsoftTeamsUser": "{{ microsoftTeamsUser }}",
"microsoftTeamsApp": "{{ microsoftTeamsApp }}"
}'
;
Adds thread participants to a thread. If participants already exist, no change occurs. Adds thread participants to a thread. If participants already exist, no change occurs.
EXEC azure.communication_chat.chat_thread.add_chat_participants
@chat_thread_id='{{ chat_thread_id }}' --required,
@endpoint='{{ endpoint }}' --required
@@json=
'{
"participants": "{{ participants }}"
}'
;
Posts a typing event to a thread, on behalf of a user. Posts a typing event to a thread, on behalf of a user.
EXEC azure.communication_chat.chat_thread.send_typing_notification
@chat_thread_id='{{ chat_thread_id }}' --required,
@endpoint='{{ endpoint }}' --required
@@json=
'{
"senderDisplayName": "{{ senderDisplayName }}"
}'
;