## Send a message

**post** `/v1/chats/{chatID}/messages`

Send a text message to a specific chat. Supports replying to existing messages. Returns a pending message ID.

### Path Parameters

- `chatID: string`

  Chat ID. Input routes also accept the local chat ID from this installation when available.

### Body Parameters

- `attachment: optional object { uploadID, duration, fileName, 3 more }`

  Single attachment to send with the message

  - `uploadID: string`

    Upload ID from uploadAsset endpoint. Required to reference uploaded files.

  - `duration: optional number`

    Duration in seconds (optional override of cached value)

  - `fileName: optional string`

    Filename (optional override of cached value)

  - `mimeType: optional string`

    MIME type (optional override of cached value)

  - `size: optional object { height, width }`

    Dimensions (optional override of cached value)

    - `height: number`

    - `width: number`

  - `type: optional "image" or "video" or "audio" or 4 more`

    Attachment type hint (image, video, audio, file, gif, voice-note, sticker). If omitted, auto-detected from mimeType

    - `"image"`

    - `"video"`

    - `"audio"`

    - `"file"`

    - `"gif"`

    - `"voice-note"`

    - `"sticker"`

- `replyToMessageID: optional string`

  Provide a message ID to send this as a reply to an existing message

- `text: optional string`

  Draft text. Plain text and Markdown are converted to Beeper rich text with the same rules used by send and edit.

### Returns

- `chatID: string`

  Chat the message was actually sent to. When sending to a merged chat, this is the member chat the send was routed to.

- `pendingMessageID: string`

  Pending ID assigned to the message before the network confirms the send. Pass it to GET /v1/chats/{chatID}/messages/{messageID} to resolve, or wait for the matching message.upserted over the WebSocket.

### Example

```http
curl http://localhost:23373/v1/chats/$CHAT_ID/messages \
    -X POST \
    -H "Authorization: Bearer $BEEPER_ACCESS_TOKEN"
```

#### Response

```json
{
  "chatID": "!whatsapp_15550101002:ba_EvYDBBsZbRQAy3UOSWqG0LuTVkc.local-whatsapp.localhost",
  "pendingMessageID": "m1694783291234567"
}
```
