> ## 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.

# Events

> Reference of Events methods for the Agent Chat RTM API v3.5.

## Send event

Sends an [event object](/api/agent-chat/v3.5/rtm/data-structures#events). Use this method to send a message by specifying the `message` event type in the request.

The user must be added to the chat before they can send an event. Events with `visibility:agents` are sent to agents only, and with `visibility:all` to all users. Users with `visibility:agents` cannot send events with `visibility:all`.

The method updates the requester's `events_seen_up_to` as if they've seen all chat events.

**Specifics**

|                     |                                                                                                                                                                                                                                                                                                                              |
| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Action**          | `send_event`                                                                                                                                                                                                                                                                                                                 |
| **Required scopes** | <Tooltip tip="To send an event to a chat taking place in any group.">`chats--all:rw`</Tooltip> or <Tooltip tip="To send an event to 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**    | `incoming_event`                                                                                                                                                                                                                                                                                                             |

**Request**

| Parameter | Required | Type     | Notes                                                            |
| --------- | -------- | -------- | ---------------------------------------------------------------- |
| `chat_id` | Yes      | `string` | The ID of the chat you want to send the message to.              |
| `event`   | Yes      | `object` | An event object. Does not support the `form` type event in Text. |

**Response**

| Field      | Type     | Notes |
| ---------- | -------- | ----- |
| `event_id` | `string` |       |

```json title="Request" theme={null}
{
  "action": "send_event",
  "payload": {
    "chat_id": "PW94SJTGW6",
    "event": {
      "type": "message",
      "text": "hello world",
      "visibility": "all"
    }
  }
}
```

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

***

## Send rich message postback

**Specifics**

|                     |                                                                                                                                                                                                                                                                                                                                  |
| ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Action**          | `send_rich_message_postback`                                                                                                                                                                                                                                                                                                     |
| **Required scopes** | <Tooltip tip="To send a postback to a chat taking place in any group.">`chats--all:rw`</Tooltip> or <Tooltip tip="To send a postback to 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**    | `incoming_rich_message_postback`\*                                                                                                                                                                                                                                                                                               |

\* `incoming_rich_message_postback` is sent only for active threads.

**Request**

| Parameter          | Required | Type     | Notes                            |
| ------------------ | -------- | -------- | -------------------------------- |
| `chat_id`          | Yes      | `string` |                                  |
| `event_id`         | Yes      | `string` |                                  |
| `postback`         | Yes      | `object` |                                  |
| `postback.id`      | Yes      | `string` | The postback name of the button. |
| `postback.toggled` | Yes      | `bool`   | Whether the postback is toggled. |
| `thread_id`        | Yes      | `string` |                                  |

No response payload.

```json title="Request" theme={null}
{
  "action": "send_rich_message_postback",
  "payload": {
    "chat_id": "PJ0MRSHTDG",
    "thread_id": "K600PKZON8",
    "event_id": "a0c22fdd-fb71-40b5-bfc6-a8a0bc3117f7",
    "postback": {
      "id": "Method URL_yes",
      "toggled": true
    }
  }
}
```

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