Share via


Chat Thread - Send Chat Message

スレッドにメッセージを送信します。

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

URI パラメーター

名前 / 必須 説明
chatThreadId
path True

string

メッセージを送信するスレッド ID。

endpoint
path True

string

Azure Communication リソースのエンドポイント。

api-version
query True

string

呼び出す API のバージョン。

要求ヘッダー

名前 必須 説明
Authorization True

string

ACS (Azure Communication Services) ユーザー アクセス トークン。

要求本文

名前 必須 説明
content True

string

チャット メッセージの内容。

attachments

ChatAttachment[]

添付ファイルの配列

metadata

object

メッセージ メタデータ。

senderDisplayName

string

チャット メッセージ送信者の表示名。 このプロパティは、プッシュ通知の送信者名を設定するために使用されます。

type

ChatMessageType

チャット メッセージの種類。

応答

名前 説明
201 Created

SendChatMessageResult

送信されたメッセージ。 Location ヘッダーには、新しく送信されたメッセージの URL が含まれます。

401 Unauthorized

CommunicationErrorResponse

権限がありません。

403 Forbidden

CommunicationErrorResponse

Forbidden.

429 Too Many Requests

CommunicationErrorResponse

要求が多すぎます。

Other Status Codes

CommunicationErrorResponse

Service unavailable. (サービス利用不可。)

セキュリティ

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

定義

名前 説明
ChatAttachment

チャット メッセージの添付ファイル。 現在、Teams 相互運用シナリオでのみサポートされています。

ChatAttachmentType

添付ファイルの種類。

ChatMessageType

チャット メッセージの種類。

SendChatMessageRequest

送信するメッセージの詳細。

SendChatMessageResult

メッセージ送信操作の結果。

ChatAttachment

チャット メッセージの添付ファイル。 現在、Teams 相互運用シナリオでのみサポートされています。

名前 説明
attachmentType

ChatAttachmentType

添付ファイルの種類。

id

string

添付ファイルの ID

name

string

添付ファイルの内容の名前。

previewUrl

string

添付ファイルのプレビューをダウンロードできる URL

url

string

添付ファイルをダウンロードできる URL

ChatAttachmentType

添付ファイルの種類。

名前 説明
file

string

image

string

ChatMessageType

チャット メッセージの種類。

名前 説明
html

string

participantAdded

string

participantRemoved

string

text

string

topicUpdated

string

SendChatMessageRequest

送信するメッセージの詳細。

名前 説明
attachments

ChatAttachment[]

添付ファイルの配列

content

string

チャット メッセージの内容。

metadata

object

メッセージ メタデータ。

senderDisplayName

string

チャット メッセージ送信者の表示名。 このプロパティは、プッシュ通知の送信者名を設定するために使用されます。

type

ChatMessageType

チャット メッセージの種類。

SendChatMessageResult

メッセージ送信操作の結果。

名前 説明
id

string

サーバーによって生成されたメッセージ ID。