# app.protoimsg.chat.message

> Published by [lexicons.protoimsg.app](https://lexicon.garden/identity/did:plc:xk3xpcauatfephlieonmluh4)

✓ This is the authoritative definition for this NSID.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:xk3xpcauatfephlieonmluh4/app.protoimsg.chat.message)
- [Documentation](https://lexicon.garden/lexicon/did:plc:xk3xpcauatfephlieonmluh4/app.protoimsg.chat.message/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:xk3xpcauatfephlieonmluh4/app.protoimsg.chat.message/examples)

## Definitions

### `app.protoimsg.chat.message#tag`

**Type**: `object`

Facet feature for a hashtag. The text usually includes a '#' prefix, but the facet reference should not.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `tag` | `string` | Yes |  |

### `app.protoimsg.chat.message#bold`

**Type**: `object`

Facet feature for bold text.

| Property | Type | Required | Description |
|----------|------|----------|-------------|

### `app.protoimsg.chat.message#link`

**Type**: `object`

Facet feature for a URL. The text URL may have been simplified or truncated, but the facet reference should be a complete URL.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `uri` | `string` (uri) | Yes |  |

### `app.protoimsg.chat.message`

**Type**: `record`

A chat message. Lives in the sender's repo, points to a channel.

**Key**: `tid`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `text` | `string` | Yes | Message text content. |
| `embed` | `union` | No | Embedded media or link card. |
| `reply` | `ref` → `#replyRef` | No | Structured reply reference for threading. |
| `facets` | `array` | No | Rich text annotations (mentions, links, tags, formatting). Extends the Bluesky facet convention with additional formatting features. |
| `channel` | `string` (at-uri) | Yes | AT-URI of the channel record this message belongs to. |
| `createdAt` | `string` (datetime) | Yes | Timestamp of message creation. |

### `app.protoimsg.chat.message#italic`

**Type**: `object`

Facet feature for italic text.

| Property | Type | Required | Description |
|----------|------|----------|-------------|

### `app.protoimsg.chat.message#mention`

**Type**: `object`

Facet feature for mention of another account. The text is usually a handle, including a '@' prefix, but the facet reference is a DID.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `did` | `string` (did) | Yes |  |

### `app.protoimsg.chat.message#replyRef`

**Type**: `object`

Thread reply reference with root and parent for efficient deep thread traversal.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `root` | `string` (at-uri) | Yes | AT-URI of the root message in the thread. |
| `parent` | `string` (at-uri) | Yes | AT-URI of the direct parent message being replied to. |

### `app.protoimsg.chat.message#byteSlice`

**Type**: `object`

Specifies the sub-string range a facet feature applies to. Start index is inclusive, end index is exclusive. Indices are zero-indexed, counting bytes of the UTF-8 encoded text.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `byteEnd` | `integer` | Yes |  |
| `byteStart` | `integer` | Yes |  |

### `app.protoimsg.chat.message#codeBlock`

**Type**: `object`

Facet feature for a code block. The text contains the code content.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `lang` | `string` | No | Programming language for syntax highlighting. |

### `app.protoimsg.chat.message#imageItem`

**Type**: `object`

A single embedded image.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `alt` | `string` | Yes | Alt text for accessibility. |
| `image` | `blob` | Yes | Image blob reference. |
| `aspectRatio` | `ref` → `#aspectRatio` | No |  |

### `app.protoimsg.chat.message#blockquote`

**Type**: `object`

Facet feature for a block quotation.

| Property | Type | Required | Description |
|----------|------|----------|-------------|

### `app.protoimsg.chat.message#codeInline`

**Type**: `object`

Facet feature for inline code.

| Property | Type | Required | Description |
|----------|------|----------|-------------|

### `app.protoimsg.chat.message#imageEmbed`

**Type**: `object`

Embedded images.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `images` | `array` | Yes |  |

### `app.protoimsg.chat.message#videoEmbed`

**Type**: `object`

Embedded video.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `alt` | `string` | No | Alt text for accessibility. |
| `video` | `blob` | Yes | Video blob reference. |
| `thumbnail` | `blob` | No | Video thumbnail image. |
| `aspectRatio` | `ref` → `#aspectRatio` | No |  |

### `app.protoimsg.chat.message#aspectRatio`

**Type**: `object`

Width and height for layout before media loads.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `width` | `integer` | Yes |  |
| `height` | `integer` | Yes |  |

### `app.protoimsg.chat.message#externalEmbed`

**Type**: `object`

External link card.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `uri` | `string` (uri) | Yes | URL of the external content. |
| `thumb` | `blob` | No | Thumbnail image for the link card. |
| `title` | `string` | Yes | Title of the external content. |
| `description` | `string` | No | Description or summary. |

### `app.protoimsg.chat.message#richTextFacet`

**Type**: `object`

Annotation of a sub-string within rich text.

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `index` | `ref` → `#byteSlice` | Yes |  |
| `features` | `array` | Yes |  |

### `app.protoimsg.chat.message#strikethrough`

**Type**: `object`

Facet feature for strikethrough text.

| Property | Type | Required | Description |
|----------|------|----------|-------------|

## Raw Schema

```json
{
  "id": "app.protoimsg.chat.message",
  "defs": {
    "tag": {
      "type": "object",
      "required": [
        "tag"
      ],
      "properties": {
        "tag": {
          "type": "string",
          "maxLength": 640,
          "maxGraphemes": 64
        }
      },
      "description": "Facet feature for a hashtag. The text usually includes a '#' prefix, but the facet reference should not."
    },
    "bold": {
      "type": "object",
      "properties": {},
      "description": "Facet feature for bold text."
    },
    "link": {
      "type": "object",
      "required": [
        "uri"
      ],
      "properties": {
        "uri": {
          "type": "string",
          "format": "uri"
        }
      },
      "description": "Facet feature for a URL. The text URL may have been simplified or truncated, but the facet reference should be a complete URL."
    },
    "main": {
      "key": "tid",
      "type": "record",
      "record": {
        "type": "object",
        "required": [
          "channel",
          "text",
          "createdAt"
        ],
        "properties": {
          "text": {
            "type": "string",
            "maxLength": 3000,
            "description": "Message text content.",
            "maxGraphemes": 1000
          },
          "embed": {
            "refs": [
              "#imageEmbed",
              "#videoEmbed",
              "#externalEmbed"
            ],
            "type": "union",
            "description": "Embedded media or link card."
          },
          "reply": {
            "ref": "#replyRef",
            "type": "ref",
            "description": "Structured reply reference for threading."
          },
          "facets": {
            "type": "array",
            "items": {
              "ref": "#richTextFacet",
              "type": "ref"
            },
            "description": "Rich text annotations (mentions, links, tags, formatting). Extends the Bluesky facet convention with additional formatting features."
          },
          "channel": {
            "type": "string",
            "format": "at-uri",
            "description": "AT-URI of the channel record this message belongs to."
          },
          "createdAt": {
            "type": "string",
            "format": "datetime",
            "description": "Timestamp of message creation."
          }
        }
      },
      "description": "A chat message. Lives in the sender's repo, points to a channel."
    },
    "italic": {
      "type": "object",
      "properties": {},
      "description": "Facet feature for italic text."
    },
    "mention": {
      "type": "object",
      "required": [
        "did"
      ],
      "properties": {
        "did": {
          "type": "string",
          "format": "did"
        }
      },
      "description": "Facet feature for mention of another account. The text is usually a handle, including a '@' prefix, but the facet reference is a DID."
    },
    "replyRef": {
      "type": "object",
      "required": [
        "root",
        "parent"
      ],
      "properties": {
        "root": {
          "type": "string",
          "format": "at-uri",
          "description": "AT-URI of the root message in the thread."
        },
        "parent": {
          "type": "string",
          "format": "at-uri",
          "description": "AT-URI of the direct parent message being replied to."
        }
      },
      "description": "Thread reply reference with root and parent for efficient deep thread traversal."
    },
    "byteSlice": {
      "type": "object",
      "required": [
        "byteStart",
        "byteEnd"
      ],
      "properties": {
        "byteEnd": {
          "type": "integer",
          "minimum": 0
        },
        "byteStart": {
          "type": "integer",
          "minimum": 0
        }
      },
      "description": "Specifies the sub-string range a facet feature applies to. Start index is inclusive, end index is exclusive. Indices are zero-indexed, counting bytes of the UTF-8 encoded text."
    },
    "codeBlock": {
      "type": "object",
      "properties": {
        "lang": {
          "type": "string",
          "maxLength": 50,
          "description": "Programming language for syntax highlighting."
        }
      },
      "description": "Facet feature for a code block. The text contains the code content."
    },
    "imageItem": {
      "type": "object",
      "required": [
        "image",
        "alt"
      ],
      "properties": {
        "alt": {
          "type": "string",
          "maxLength": 2000,
          "description": "Alt text for accessibility."
        },
        "image": {
          "type": "blob",
          "accept": [
            "image/png",
            "image/jpeg",
            "image/gif",
            "image/webp"
          ],
          "maxSize": 1000000,
          "description": "Image blob reference."
        },
        "aspectRatio": {
          "ref": "#aspectRatio",
          "type": "ref"
        }
      },
      "description": "A single embedded image."
    },
    "blockquote": {
      "type": "object",
      "properties": {},
      "description": "Facet feature for a block quotation."
    },
    "codeInline": {
      "type": "object",
      "properties": {},
      "description": "Facet feature for inline code."
    },
    "imageEmbed": {
      "type": "object",
      "required": [
        "images"
      ],
      "properties": {
        "images": {
          "type": "array",
          "items": {
            "ref": "#imageItem",
            "type": "ref"
          },
          "maxLength": 4
        }
      },
      "description": "Embedded images."
    },
    "videoEmbed": {
      "type": "object",
      "required": [
        "video"
      ],
      "properties": {
        "alt": {
          "type": "string",
          "maxLength": 2000,
          "description": "Alt text for accessibility."
        },
        "video": {
          "type": "blob",
          "accept": [
            "video/mp4",
            "video/webm"
          ],
          "maxSize": 50000000,
          "description": "Video blob reference."
        },
        "thumbnail": {
          "type": "blob",
          "accept": [
            "image/png",
            "image/jpeg"
          ],
          "maxSize": 1000000,
          "description": "Video thumbnail image."
        },
        "aspectRatio": {
          "ref": "#aspectRatio",
          "type": "ref"
        }
      },
      "description": "Embedded video."
    },
    "aspectRatio": {
      "type": "object",
      "required": [
        "width",
        "height"
      ],
      "properties": {
        "width": {
          "type": "integer",
          "minimum": 1
        },
        "height": {
          "type": "integer",
          "minimum": 1
        }
      },
      "description": "Width and height for layout before media loads."
    },
    "externalEmbed": {
      "type": "object",
      "required": [
        "uri",
        "title"
      ],
      "properties": {
        "uri": {
          "type": "string",
          "format": "uri",
          "description": "URL of the external content."
        },
        "thumb": {
          "type": "blob",
          "accept": [
            "image/png",
            "image/jpeg"
          ],
          "maxSize": 1000000,
          "description": "Thumbnail image for the link card."
        },
        "title": {
          "type": "string",
          "maxLength": 300,
          "description": "Title of the external content."
        },
        "description": {
          "type": "string",
          "maxLength": 1000,
          "description": "Description or summary."
        }
      },
      "description": "External link card."
    },
    "richTextFacet": {
      "type": "object",
      "required": [
        "index",
        "features"
      ],
      "properties": {
        "index": {
          "ref": "#byteSlice",
          "type": "ref"
        },
        "features": {
          "type": "array",
          "items": {
            "refs": [
              "#mention",
              "#link",
              "#tag",
              "#bold",
              "#italic",
              "#strikethrough",
              "#codeInline",
              "#codeBlock",
              "#blockquote"
            ],
            "type": "union"
          }
        }
      },
      "description": "Annotation of a sub-string within rich text."
    },
    "strikethrough": {
      "type": "object",
      "properties": {},
      "description": "Facet feature for strikethrough text."
    }
  },
  "$type": "com.atproto.lexicon.schema",
  "lexicon": 1
}
```
