> ## Documentation Index
> Fetch the complete documentation index at: https://www.text.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Chat users

> Reference of Chat users methods for the Agent Chat RTM API v3.7.

## Add user to chat

Adds a user to the chat. The following restrictions apply:

* The chat must be active.
* The requester must be present on the list of chat users. You can override it by setting the `ignore_requester_presence` parameter.
* You can't have more than one `customer` in the chat.
* Additional agents must also have access to the chat.
* `customer` must be added with `visibility:all`.

**Specifics**

|                     |                                                                                                                                                                                                                                                                                                                          |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Action**          | `add_user_to_chat`                                                                                                                                                                                                                                                                                                       |
| **Required scopes** | <Tooltip tip="To add the requester to a chat taking place in any group.">`chats--all:rw`</Tooltip> or <Tooltip tip="To add a user to a chat taking place in groups that the user is a member of. The agent groups and the chat groups must overlap — at least one group must be in common.">`chats--access:rw`</Tooltip> |
| **Push message**    | `user_added_to_chat`                                                                                                                                                                                                                                                                                                     |

**Request**

| Parameter                   | Required | Type     | Notes                                                                                 |
| --------------------------- | -------- | -------- | ------------------------------------------------------------------------------------- |
| `chat_id`                   | Yes      | `string` |                                                                                       |
| `user_id`                   | Yes      | `string` |                                                                                       |
| `user_type`                 | Yes      | `string` | Possible values: `agent`, `customer`.                                                 |
| `visibility`                | Yes      | `string` | Possible values: `all`, `agents`.                                                     |
| `ignore_requester_presence` | No       | `bool`   | If set to `true`: the requester doesn't need to be present on the list of chat users. |

No response payload.

```json title="Request" theme={null}
{
  "action": "add_user_to_chat",
  "payload": {
    "chat_id": "PW94SJTGW6",
    "user_id": "smith@example.com",
    "user_type": "agent",
    "visibility": "all"
  }
}
```

```json title="Response" theme={null}
{
  "request_id": "<request_id>",
  "action": "add_user_to_chat",
  "type": "response",
  "success": true,
  "payload": {}
}
```

***

## Remove user from chat

Removes a user from chat. The following restrictions apply:

* You can't remove the `customer`.
* The requester must be present on the list of chat users. You can override it by setting the `ignore_requester_presence` parameter.

**Specifics**

|                     |                                                                                                                                                                                                                                                                                                                                  |
| ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Action**          | `remove_user_from_chat`                                                                                                                                                                                                                                                                                                          |
| **Required scopes** | <Tooltip tip="To remove a user from a chat taking place in any group.">`chats--all:rw`</Tooltip> or <Tooltip tip="To remove a user from a chat taking place in groups that the requester is a member of. The agent groups and the chat groups must overlap — at least one group must be in common.">`chats--access:rw`</Tooltip> |
| **Push message**    | `user_removed_from_chat`                                                                                                                                                                                                                                                                                                         |

**Request**

| Parameter                   | Required | Type     | Notes                                                                                                   |
| --------------------------- | -------- | -------- | ------------------------------------------------------------------------------------------------------- |
| `chat_id`                   | Yes      | `string` |                                                                                                         |
| `user_id`                   | Yes      | `string` |                                                                                                         |
| `user_type`                 | Yes      | `string` | Possible values: `agent`.                                                                               |
| `ignore_requester_presence` | No       | `bool`   | If set to `true`: the requester doesn't need to be present on the list of chat users. Default: `false`. |

No response payload.

```json title="Request" theme={null}
{
  "action": "remove_user_from_chat",
  "payload": {
    "chat_id": "PW94SJTGW6",
    "user_id": "smith@example.com",
    "user_type": "agent"
  }
}
```

```json title="Response" theme={null}
{
  "request_id": "<request_id>",
  "action": "remove_user_from_chat",
  "type": "response",
  "success": true,
  "payload": {}
}
```
