다음을 통해 공유


Chat Thread - Send Chat Message

스레드에 메시지를 보냅니다.

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

URI 매개 변수

Name In(다음 안에) 필수 형식 Description
chatThreadId
path True

string

메시지를 보낼 스레드 ID입니다.

endpoint
path True

string

Azure Communication 리소스의 엔드포인트입니다.

api-version
query True

string

호출할 API의 버전입니다.

요청 헤더

Name 필수 형식 Description
Authorization True

string

ACS(Azure Communication Services) 사용자 액세스 토큰입니다.

요청 본문

Name 필수 형식 Description
content True

string

채팅 메시지 콘텐츠.

attachments

ChatAttachment[]

첨부 파일의 배열

metadata

object

메시지 메타데이터.

senderDisplayName

string

채팅 메시지 보낸 사람의 표시 이름입니다. 이 속성은 푸시 알림에 대한 보낸 사람 이름을 채우는 데 사용됩니다.

type

ChatMessageType

채팅 메시지 유형입니다.

응답

Name 형식 Description
201 Created

SendChatMessageResult

메시지가 전송되면 헤더에 Location 새로 보낸 메시지의 URL이 포함됩니다.

401 Unauthorized

CommunicationErrorResponse

권한이 없습니다.

403 Forbidden

CommunicationErrorResponse

사용할 수 없습니다.

429 Too Many Requests

CommunicationErrorResponse

요청이 너무 많습니다.

Other Status Codes

CommunicationErrorResponse

서비스를 사용할 수 없습니다.

보안

Authorization

ACS(Azure Communication Services) 사용자 액세스 토큰입니다.

Type: apiKey
In: header

예제

Send Message

Sample Request

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

{
  "content": "Let's head out for lunch in 15 minutes.",
  "senderDisplayName": "Jane",
  "metadata": {
    "someKey1": "someValue1",
    "someKey2": "someValue2"
  }
}

Sample Response

Location: https://contoso.westus.communications.azure.com/chat/threads/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/messages/1593072104708
{
  "id": "1593072104708"
}
{
  "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."
  }
}

정의

Name Description
ChatAttachment

채팅 메시지의 첨부 파일입니다. 현재 Teams Interop 시나리오에서만 지원됩니다.

ChatAttachmentType

첨부 파일의 형식입니다.

ChatMessageType

채팅 메시지 유형입니다.

SendChatMessageRequest

보낼 메시지의 세부 정보입니다.

SendChatMessageResult

메시지 보내기 작업의 결과입니다.

ChatAttachment

채팅 메시지의 첨부 파일입니다. 현재 Teams Interop 시나리오에서만 지원됩니다.

Name 형식 Description
attachmentType

ChatAttachmentType

첨부 파일의 형식입니다.

id

string

첨부 파일의 ID

name

string

첨부 파일 콘텐츠의 이름입니다.

previewUrl

string

첨부 파일 미리 보기를 다운로드할 수 있는 URL

url

string

첨부 파일을 다운로드할 수 있는 URL

ChatAttachmentType

첨부 파일의 형식입니다.

Name 형식 Description
file

string

image

string

ChatMessageType

채팅 메시지 유형입니다.

Name 형식 Description
html

string

participantAdded

string

participantRemoved

string

text

string

topicUpdated

string

SendChatMessageRequest

보낼 메시지의 세부 정보입니다.

Name 형식 Description
attachments

ChatAttachment[]

첨부 파일의 배열

content

string

채팅 메시지 콘텐츠.

metadata

object

메시지 메타데이터.

senderDisplayName

string

채팅 메시지 보낸 사람의 표시 이름입니다. 이 속성은 푸시 알림에 대한 보낸 사람 이름을 채우는 데 사용됩니다.

type

ChatMessageType

채팅 메시지 유형입니다.

SendChatMessageResult

메시지 보내기 작업의 결과입니다.

Name 형식 Description
id

string

서버에서 생성된 메시지 ID입니다.