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

# Sending Messages

> How to send messages, handle responses, and maintain the WebSocket connection.

## Sending a User Message

```json theme={null}
{
  "message": "Your message text here",
  "type": "message"
}
```

**Receive confirmation:**

```json theme={null}
{
  "type": "recv",
  "id": "{message-id}",
  "profilepic": "{user-profile-pic}",
  "name": "Anonymous",
  "content": "Your message text here"
}
```

## Receiving AI Responses

```json theme={null}
{
  "type": "message",
  "id": "{message-id}",
  "profilepic": "{assistant-image-url}",
  "name": "Assistant",
  "content": "AI response text here"
}
```

## Typing Indicators

Signal when the user is typing (visible in the Plura AI inbox dashboard):

```json theme={null}
{ "message": true, "type": "typing" }
```

```json theme={null}
{ "message": false, "type": "typing" }
```

## Heartbeat

<Warning>
  **Required.** Send a heartbeat every **15 seconds** to maintain the connection and show the user as online.
</Warning>

```json theme={null}
{
  "message": {
    "stamp": "2025-11-06T21:59:02",
    "tz": "+04:00"
  },
  "type": "heartbeat"
}
```

| Field   | Format                | Example               |
| ------- | --------------------- | --------------------- |
| `stamp` | `YYYY-MM-DDTHH:mm:ss` | `2025-11-06T21:59:02` |
| `tz`    | Timezone offset       | `+04:00`, `-05:00`    |

## Message Types Reference

| Type        | Direction      | Description                                  |
| ----------- | -------------- | -------------------------------------------- |
| `message`   | Send / Receive | User message (send) or AI response (receive) |
| `recv`      | Receive        | Confirmation that your message was received  |
| `session`   | Receive        | Session ID on initial connect                |
| `chatowner` | Receive        | Chat owner info on initial connect           |
| `typing`    | Send           | Typing indicator                             |
| `heartbeat` | Send           | Keep-alive signal (every 15s)                |
