> ## 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 Customer Chat RTM API v3.5.

## Send event

Sends an event object. Use this method to send a message by specifying the message event type in the request. Updates the requester's `events_seen_up_to` as if they've seen all chat events.

**Specifics**

| | |
| - | - |
| **Action** | `send_event` |
| **Web API equivalent** | [`send_event`](https://www.text.com/docs/api/customer-chat/v3.5/events/send-event) |
| **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. |
| `attach_to_last_thread` | No | `bool` | The flag is ignored for active chats. For inactive chats: if set to `true`, the event will be added to the last thread. If set to `false`: the request will fail. |

**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",
      "recipients": "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` |
| **Web API equivalent** | [`send_rich_message_postback`](https://www.text.com/docs/api/customer-chat/v3.5/events/send-rich-message-postback) |
| **Push message** | `incoming_rich_message_postback` (Will be sent only for active threads.) |

**Request**

| Parameter | Required | Type | Notes |
| - | - | - | - |
| `chat_id` | Yes | `string` | |
| `thread_id` | Yes | `string` | |
| `event_id` | Yes | `string` | |
| `postback` | Yes | `object` | |
| `postback.id` | Yes | `string` | The postback name of the button. |
| `postback.toggled` | Yes | `bool` | If set to `true`: the postback is toggled on. If set to `false`: the postback is toggled off. |

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": {}
}
```

***

## Send sneak peek

Sends a sneak peek to a chat.

**Specifics**

| | |
| - | - |
| **Action** | `send_sneak_peek` |
| **Web API equivalent** | [`send_sneak_peek`](https://www.text.com/docs/api/customer-chat/v3.5/events/send-sneak-peek) |
| **Push message** | — |

**Request**

| Parameter | Required | Type | Notes |
| - | - | - | - |
| `chat_id` | Yes | `string` | The ID of the chat to send a sneak peek to. |
| `sneak_peek_text` | Yes | `string` | The sneak peek text. |

No response payload.

```json title="Request" theme={null}
{
  "action": "send_sneak_peek",
  "payload": {
    "chat_id": "PJ0MRSHTDG",
    "sneak_peek_text": "hello world"
  }
}
```

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


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.