你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Chat Thread - Get Chat Message

按 ID 获取消息。

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

URI 参数

名称 必需 类型 说明
chatMessageId
path True

string

消息 id。

chatThreadId
path True

string

消息发送到的线程 ID。

endpoint
path True

string

Azure 通信资源的终结点。

api-version
query True

string

要调用的 API 的版本。

请求头

名称 必需 类型 说明
Authorization True

string

ACS (Azure 通信服务) 用户访问令牌。

响应

名称 类型 说明
200 OK

ChatMessage

请求成功。 操作返回资源 Message

401 Unauthorized

CommunicationErrorResponse

未授权。

403 Forbidden

CommunicationErrorResponse

已禁止。

429 Too Many Requests

CommunicationErrorResponse

请求过多。

Other Status Codes

CommunicationErrorResponse

服务不可用。

安全性

Authorization

ACS (Azure 通信服务) 用户访问令牌。

类型: apiKey
在: header

示例

Get Message

示例请求

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

示例响应

{
  "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."
  }
}

定义

名称 说明
ChatAttachment

聊天消息中的附件。 目前仅在 Teams 互操作方案中受支持。

ChatAttachmentType

附件的类型。

ChatMessage

聊天消息。

ChatMessageContent

聊天消息的内容。

ChatMessageType

聊天消息类型。

ChatParticipant

聊天线程的参与者。

ChatAttachment

聊天消息中的附件。 目前仅在 Teams 互操作方案中受支持。

名称 类型 说明
attachmentType

ChatAttachmentType

附件的类型。

id

string

附件的 ID

name

string

附件内容的名称。

previewUrl

string

可在其中下载附件预览的 URL

url

string

可以下载附件的 URL

ChatAttachmentType

附件的类型。

名称 类型 说明
file

string

image

string

ChatMessage

聊天消息。

名称 类型 说明
content

ChatMessageContent

聊天消息的内容。

createdOn

string

聊天消息到达服务器的时间戳。 时间戳采用RFC3339格式: yyyy-MM-ddTHH:mm:ssZ

deletedOn

string

如果适用,) 删除消息时时间戳 (。 时间戳采用RFC3339格式: yyyy-MM-ddTHH:mm:ssZ

editedOn

string

编辑消息时) 最后一个时间戳 ((如果适用)。 时间戳采用RFC3339格式: yyyy-MM-ddTHH:mm:ssZ

id

string

聊天消息的 ID。 此 ID 是服务器生成的。

metadata

object

消息元数据。

senderCommunicationIdentifier

CommunicationIdentifierModel

senderDisplayName

string

聊天消息发件人的显示名称。 此属性用于填充推送通知的发件人名称。

sequenceId

string

聊天中聊天消息的顺序。

type

ChatMessageType

聊天消息类型。

version

string

聊天消息的版本。

ChatMessageContent

聊天消息的内容。

名称 类型 说明
attachments

ChatAttachment[]

此邮件的附件列表

initiatorCommunicationIdentifier

CommunicationIdentifierModel

message

string

文本或 html 类型的消息的聊天消息内容。

participants

ChatParticipant[]

参与者Added或 participantRemoved 类型的消息的聊天消息内容。

topic

string

topicUpdated 类型的消息的聊天消息内容。

ChatMessageType

聊天消息类型。

名称 类型 说明
html

string

participantAdded

string

participantRemoved

string

text

string

topicUpdated

string

ChatParticipant

聊天线程的参与者。

名称 类型 说明
communicationIdentifier

CommunicationIdentifierModel

displayName

string

聊天参与者的显示名称。

metadata

object

聊天参与者的上下文元数据。 元数据由名称/值对组成。 所有元数据对的总大小最大为 1KB。

shareHistoryTime

string

与参与者共享聊天历史记录的时间。 时间戳采用RFC3339格式: yyyy-MM-ddTHH:mm:ssZ