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

# Send to a chat

> Send a message to a chat.

```bash theme={null}
npx relaymessenger@staging chats messages send
```

## Usage

```text captured-output theme={null}
Usage: relaymessenger chats messages send [options] <chat-id>

send a message to a chat

Arguments:
  chat-id                         the chat ID

Options:
  --text <text>                   the text to send
  --rating-request                request a rating; send alone
  --mention <handle>              mention this @handle written in --text
  --media <url-or-attachment-id>  an https file URL or attachment ID
  --link <url>                    a link with its preview, sent alone
  --button <label>                a reply button, or label=https://url
  --selection <json-or-file>      a list picker, as JSON
  --form <json-or-file>           a form, as JSON
  --rich-card <json-or-file>      a rich card, as JSON
  --carousel <json-or-file>       a carousel of cards, as JSON
  --place <latitude,longitude>    a place on the map
  --place-name <name>             the place's name
  --place-address <address>       the place's address
  --payment <checkout-url>        a payment request's checkout URL, sent alone
  --parts <json-or-file>          every part as a JSON array
  --reply-to <message-id>         reply to this message
  --reply-part-index <number>     reply to this part, counting from zero
  --idempotency-key <key>         duplicate-send prevention key
  --silent                        delivery without a banner or sound
  -h, --help                      help

Docs: https://docs.staging.relayapp.im
Report a problem: https://github.com/RelayMessenger/Relay-SDK/issues
```

## Options

```text captured-output theme={null}
  --text <text>                   the text to send
  --rating-request                request a rating; send alone
  --mention <handle>              mention this @handle written in --text
  --media <url-or-attachment-id>  an https file URL or attachment ID
  --link <url>                    a link with its preview, sent alone
  --button <label>                a reply button, or label=https://url
  --selection <json-or-file>      a list picker, as JSON
  --form <json-or-file>           a form, as JSON
  --rich-card <json-or-file>      a rich card, as JSON
  --carousel <json-or-file>       a carousel of cards, as JSON
  --place <latitude,longitude>    a place on the map
  --place-name <name>             the place's name
  --place-address <address>       the place's address
  --payment <checkout-url>        a payment request's checkout URL, sent alone
  --parts <json-or-file>          every part as a JSON array
  --reply-to <message-id>         reply to this message
  --reply-part-index <number>     reply to this part, counting from zero
  --idempotency-key <key>         duplicate-send prevention key
  --silent                        delivery without a banner or sound
  -h, --help                      help
```

### Global options

```text captured-output theme={null}
  -V, --version                  the version
  --json                         JSON output
  --no-input, --non-interactive  no prompts
  --agent <auto|yes|no>          runtime detection override (default auto)
  -q, --quiet                    errors only
  --verbose                      request method, path, status, milliseconds on stderr
  --profile <name>               the saved profile to use
  --install-skills               Relay skill installation for local runtimes
```

## Exit codes

```text captured-output theme={null}
relaymessenger exit codes

relaymessenger follows normal conventions regarding exit codes.

- If a command completes successfully, the exit code will be 0
- If a command fails for a reason not covered by exit codes 2–4, the exit code will be 1
- If a command is given options it does not understand, or needs an answer and has no terminal, the exit code will be 2
- If the thing a command names does not exist, the exit code will be 3
- If a command needs a token and none is saved, or Relay does not accept the one it has, the exit code will be 4

Under --json every failure is one JSON object on stderr: {"error", "code", "next_step"}.
The code is Relay's numeric code as a string for an API fault, and one of
usage, not_a_tty, no_token, not_found, network, refused for a fault in this command.

Docs: https://docs.staging.relayapp.im
Report a problem: https://github.com/RelayMessenger/Relay-SDK/issues
```

## Next steps

* [Direct and group chats](https://docs.staging.relayapp.im/chats.md)
* [CLI](https://docs.staging.relayapp.im/cli/index.md)
* [Global options](https://docs.staging.relayapp.im/cli/global-options.md)


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