# chat.yakka.postMessage

> Published by [yakka.chat](https://lexicon.garden/identity/did:plc:wpjoy2orkqq5m65vq7gg7liz)

✓ This is the authoritative definition for this NSID.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:wpjoy2orkqq5m65vq7gg7liz/chat.yakka.postMessage)
- [Documentation](https://lexicon.garden/lexicon/did:plc:wpjoy2orkqq5m65vq7gg7liz/chat.yakka.postMessage/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:wpjoy2orkqq5m65vq7gg7liz/chat.yakka.postMessage/examples)

## Definitions

### `chat.yakka.postMessage`

**Type**: `procedure`

Write a message to the author's own repo, under their OAuth grant (Law 4: write admission belongs to the author's PDS, never to the appview).

The appview is the caller's agent here, not an authority — a refusal from the PDS is reported as one rather than absorbed. Resolves once the record is ingested and sequenced, by which time the client has already shown a provisional copy and will reconcile on (uri, cid) (ADR 0011).

#### Input

**Encoding**: `application/json`

#### Output

**Encoding**: `application/json`

#### Errors

- **ChannelNotFound**
- **ChannelForbidden**: The mint declined for this viewer (ADR 0007).
- **WriteRefused**: The author's own PDS refused the write. Theirs to explain, not ours to override.
- **WriteUnconfirmed**: The record was written and the appview has not yet seen it come back through the sync path.

The write SUCCEEDED. Do not retry it — a retry writes a second record, and the two are different messages with different URIs, not one message sent twice. The message will arrive over the socket or on the next timeline read; a client should leave its provisional copy in place rather than marking it failed.

This is separate from WriteRefused because the two call for opposite responses, and a client that conflated them would double-post every time ingest ran slow.

### `chat.yakka.postMessage#input`

**Type**: `object`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `body` | `string` | Yes | The message text, in the same spelling the view returns it (chat.yakka.defs#messageView). The record it becomes calls the field `text`. |
| `channel` | `string` | Yes |  |
| `replyTo` | `string` (at-uri) | No | The message being replied to. Display order of a thread still comes from the view sequence. |

## Raw Schema

```json
{
  "id": "chat.yakka.postMessage",
  "defs": {
    "main": {
      "type": "procedure",
      "input": {
        "schema": {
          "ref": "#input",
          "type": "ref"
        },
        "encoding": "application/json"
      },
      "errors": [
        {
          "name": "ChannelNotFound"
        },
        {
          "name": "ChannelForbidden",
          "description": "The mint declined for this viewer (ADR 0007)."
        },
        {
          "name": "WriteRefused",
          "description": "The author's own PDS refused the write. Theirs to explain, not ours to override."
        },
        {
          "name": "WriteUnconfirmed",
          "description": "The record was written and the appview has not yet seen it come back through the sync path.\n\nThe write SUCCEEDED. Do not retry it — a retry writes a second record, and the two are different messages with different URIs, not one message sent twice. The message will arrive over the socket or on the next timeline read; a client should leave its provisional copy in place rather than marking it failed.\n\nThis is separate from WriteRefused because the two call for opposite responses, and a client that conflated them would double-post every time ingest ran slow."
        }
      ],
      "output": {
        "schema": {
          "ref": "chat.yakka.defs#messageView",
          "type": "ref"
        },
        "encoding": "application/json"
      },
      "description": "Write a message to the author's own repo, under their OAuth grant (Law 4: write admission belongs to the author's PDS, never to the appview).\n\nThe appview is the caller's agent here, not an authority — a refusal from the PDS is reported as one rather than absorbed. Resolves once the record is ingested and sequenced, by which time the client has already shown a provisional copy and will reconcile on (uri, cid) (ADR 0011)."
    },
    "input": {
      "type": "object",
      "required": [
        "channel",
        "body"
      ],
      "properties": {
        "body": {
          "type": "string",
          "maxLength": 10000,
          "description": "The message text, in the same spelling the view returns it (chat.yakka.defs#messageView). The record it becomes calls the field `text`.",
          "maxGraphemes": 2000
        },
        "channel": {
          "type": "string"
        },
        "replyTo": {
          "type": "string",
          "format": "at-uri",
          "description": "The message being replied to. Display order of a thread still comes from the view sequence."
        }
      }
    }
  },
  "$type": "com.atproto.lexicon.schema",
  "lexicon": 1
}
```
