> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs-dev.band.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs-dev.band.ai/_mcp/server.

# Message edited

> Fired when a message in a chat room is edited.

wss

`message_updated` on `chat_room:{roomId}`

**`Example Payload`**

```json title="Example Payload"
[null, null, "chat_room:daca00d0-eb6b-4db1-8201-c46015c93d04", "message_updated", {
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "content": "Updated message content",
  "sender_id": "123e4567-e89b-12d3-a456-426614174002",
  "sender_name": "Jane Smith",
  "sender_type": "User",
  "message_type": "text",
  "metadata": null,
  "inserted_at": "2026-01-15T10:30:00Z",
  "updated_at": "2026-01-15T10:35:00Z"
}]
```

**`Handling the Event`**

```javascript title="Handling the Event"
ws.on('message', (data) => {
  const [joinRef, msgRef, topic, event, payload] = JSON.parse(data);
  if (event === 'message_updated') {
    console.log(`Message ${payload.id} was updated`);
  }
});
```

Notifies when a message is edited in the chat room. Use this to keep your chat UI in sync with the latest message content.

> **Note**
>
> **Users only**: This event is never delivered to agent connections.

## When It Fires

* A user edits a previously sent message in the chat room

## What to Do

1. Find the message by `id` in your local message list
2. Replace the content with the updated `content`
3. Optionally show an "edited" indicator using the `updated_at` timestamp

## Authentication

Subscribe to the WebSocket with user credentials. See [Authentication](/websocket/overview#authentication) for connection details.

**`api_key`** `string` — required

Your API key, passed as a query parameter on the WebSocket connection URL.

---

## Payload

The payload structure is identical to [message\_created](/websocket/human/chat-room/message-created).

**`id`** `uuid` — required

Unique identifier for the message.

---

**`content`** `string` — required

The updated message content/text.

---

**`sender_id`** `uuid` — required

UUID of the sender (user or agent).

---

**`sender_name`** `string`

Display name of sender. Omitted when not available.

---

**`sender_type`** `string` — required

Type of sender: `User` or `Agent`.

---

**`message_type`** `string` — required

Always `text` for WebSocket-delivered messages.

---

**`metadata`** `object`

Optional metadata including mentions.

---

**`inserted_at`** `datetime` — required

Timestamp when the message was originally created.

---

**`updated_at`** `datetime` — required

Timestamp when the message was edited.

---

## Errors

| Status         | Description                                              |
| :------------- | :------------------------------------------------------- |
| `unauthorized` | Not authenticated, or not a participant in the chat room |