Chat Thread - Get Chat Message

Gets a message by id.

GET {endpoint}/chat/threads/{chatThreadId}/messages/{chatMessageId}?api-version=2024-03-07

URI Parameters

Name In Required Type Description
chatMessageId
path True

string

The message id.

chatThreadId
path True

string

The thread id to which the message was sent.

endpoint
path True

string

The endpoint of the Azure Communication resource.

api-version
query True

string

Version of API to invoke.

Request Header

Name Required Type Description
Authorization True

string

An ACS (Azure Communication Services) user access token.

Responses

Name Type Description
200 OK

ChatMessage

Request successful. The action returns a Message resource.

401 Unauthorized

CommunicationErrorResponse

Unauthorized.

403 Forbidden

CommunicationErrorResponse

Forbidden.

429 Too Many Requests

CommunicationErrorResponse

Too many requests.

Other Status Codes

CommunicationErrorResponse

Service unavailable.

Security

Authorization

An ACS (Azure Communication Services) user access token.

Type: apiKey
In: header

Examples

Get Message

Sample request

GET https://contoso.westus.communications.azure.com/chat/threads/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/messages/1591768249318?api-version=2024-03-07

Sample response

{
  "id": "1591768249318",
  "sequenceId": "1",
  "type": "text",
  "version": "1599016601134",
  "content": {
    "message": "Let's head out for lunch in 15 minutes."
  },
  "senderDisplayName": "Jane",
  "createdOn": "2020-06-10T05:50:49.3180000Z",
  "senderCommunicationIdentifier": {
    "rawId": "8:acs:8540c0de-899f-5cce-acb5-3ec493af3800_0e59221d-0c1d-46ae-9544-c963ce56c10b",
    "communicationUser": {
      "id": "8:acs:8540c0de-899f-5cce-acb5-3ec493af3800_0e59221d-0c1d-46ae-9544-c963ce56c10b"
    }
  },
  "metadata": {
    "someKey1": "someValue1",
    "someKey2": "someValue2"
  }
}
{
  "error": {
    "code": "Unauthorized",
    "message": "Request is not authorized."
  }
}
{
  "error": {
    "code": "Forbidden",
    "message": "User is not allowed to perform specified action."
  }
}
{
  "error": {
    "code": "TooManyRequests",
    "message": "Rate limit exceeded."
  }
}
{
  "error": {
    "code": "ServiceUnavailable",
    "message": "The server is currently unable to handle the request."
  }
}

Definitions

Name Description
ChatAttachment

An attachment in a chat message.

ChatAttachmentType

The type of attachment.

ChatMessage

Chat message.

ChatMessageContent

Content of a chat message.

ChatMessageType

The chat message type.

ChatParticipant

A participant of the chat thread.

ChatAttachment

An attachment in a chat message.

Name Type Description
attachmentType

ChatAttachmentType

The type of attachment.

id

string

Id of the attachment

name

string

The name of the attachment content.

previewUrl

string

The URL where the preview of attachment can be downloaded

url

string

The URL where the attachment can be downloaded

ChatAttachmentType

The type of attachment.

Name Type Description
file

string

image

string

ChatMessage

Chat message.

Name Type Description
content

ChatMessageContent

Content of a chat message.

createdOn

string

The timestamp when the chat message arrived at the server. The timestamp is in RFC3339 format: yyyy-MM-ddTHH:mm:ssZ.

deletedOn

string

The timestamp (if applicable) when the message was deleted. The timestamp is in RFC3339 format: yyyy-MM-ddTHH:mm:ssZ.

editedOn

string

The last timestamp (if applicable) when the message was edited. The timestamp is in RFC3339 format: yyyy-MM-ddTHH:mm:ssZ.

id

string

The id of the chat message. This id is server generated.

metadata

object

Message metadata.

senderCommunicationIdentifier

CommunicationIdentifierModel

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.

type

ChatMessageType

The chat message type.

version

string

Version of the chat message.

ChatMessageContent

Content of a chat message.

Name Type Description
attachments

ChatAttachment[]

List of attachments for this message

initiatorCommunicationIdentifier

CommunicationIdentifierModel

message

string

Chat message content for messages of types text or html.

participants

ChatParticipant[]

Chat message content for messages of types participantAdded or participantRemoved.

topic

string

Chat message content for messages of type topicUpdated.

ChatMessageType

The chat message type.

Name Type Description
html

string

participantAdded

string

participantRemoved

string

text

string

topicUpdated

string

ChatParticipant

A participant of the chat thread.

Name Type Description
communicationIdentifier

CommunicationIdentifierModel

displayName

string

Display name for the chat participant.

shareHistoryTime

string

Time from which the chat history is shared with the participant. The timestamp is in RFC3339 format: yyyy-MM-ddTHH:mm:ssZ.