Chat Thread - Add Chat Participants

Adds thread participants to a thread. If participants already exist, no change occurs.

POST {endpoint}/chat/threads/{chatThreadId}/participants/:add?api-version=2024-03-07

URI Parameters

Name In Required Type Description
chatThreadId
path True

string

Id of the thread to add participants to.

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.

Request Body

Name Required Type Description
participants True

ChatParticipant[]

Participants to add to a chat thread.

Responses

Name Type Description
201 Created

AddChatParticipantsResult

The participants were successfully added.

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

Add participants

Sample Request

POST https://contoso.westus.communications.azure.com/chat/threads/19:f2167429acf6482880c6b7790a9086c1@thread.v2/participants/:add?api-version=2024-03-07

{
  "participants": [
    {
      "communicationIdentifier": {
        "rawId": "8:acs:8540c0de-899f-5cce-acb5-3ec493af3800_c94ff260-162d-46d6-94fd-e79f4d213715",
        "communicationUser": {
          "id": "8:acs:8540c0de-899f-5cce-acb5-3ec493af3800_c94ff260-162d-46d6-94fd-e79f4d213715"
        }
      },
      "displayName": "Alex",
      "shareHistoryTime": "2020-06-06T05:55:41Z"
    },
    {
      "communicationIdentifier": {
        "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"
        }
      },
      "displayName": "Peter",
      "shareHistoryTime": "2020-06-06T05:55:41Z"
    },
    {
      "communicationIdentifier": {
        "rawId": "8:acs:8540c0de-899f-5cce-acb5-3ec493af3800_f13a9208-0bb8-45c0-916c-f3ed922728ce",
        "communicationUser": {
          "id": "8:acs:8540c0de-899f-5cce-acb5-3ec493af3800_f13a9208-0bb8-45c0-916c-f3ed922728ce"
        }
      },
      "displayName": "Rama",
      "shareHistoryTime": "2020-06-06T05:55:41Z"
    }
  ]
}

Sample Response

{
  "invalidParticipants": [
    {
      "target": "8:acs:8540c0de-899f-5cce-acb5-3ec493af3800_a34d2d65-d72f-4c48-a12c-2d5c9ac75a1a",
      "code": "403",
      "message": "Permissions check failed"
    },
    {
      "target": "8:acs:8540c0de-899f-5cce-acb5-3ec493af3800_f6762773-e33a-4727-985f-50bd1d197c7b",
      "code": "404",
      "message": "Not found"
    }
  ]
}
{
  "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
AddChatParticipantsRequest

Participants to be added to the thread.

AddChatParticipantsResult

Result of the add chat participants operation.

ChatParticipant

A participant of the chat thread.

AddChatParticipantsRequest

Participants to be added to the thread.

Name Type Description
participants

ChatParticipant[]

Participants to add to a chat thread.

AddChatParticipantsResult

Result of the add chat participants operation.

Name Type Description
invalidParticipants

CommunicationError[]

The participants that failed to be added to the chat thread.

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.