Send Chat Message
ethora-chats-message-v2Post a message into a chat room of an app (POST /v2/apps/:appId/chats/broadcast targeting one room). The message is attributed to the app's broadcast sender (override the shown name with senderName). Use it to seed or test a conversation, e.g. right after ethora-agent-invite-to-chat, and set waitForReplySec (up to 60) to wait for an AI agent's answer; replies are returned in replies. Identify the room by roomJid (${appId}_${chatId}, exactly what ethora-app-create-chat returns as jid) or by the bare chatId plus the selected app.
Auth: user auth (the default on the hosted server) or B2B; app-token mode is not accepted by this route. Errors: 401 not logged in; 403 not the app owner; 404 unknown app/room; 422 empty text. Reply detection needs the message archive (MAM) on the deployment; when it is unavailable replies is null and historyUnavailable is true.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | Message body to post (1-4000 chars). | |
| appId | No | 24-char hex appId. Optional when `roomJid` carries it or an app is selected. | |
| chatId | No | Chat id: either the Mongo chat `_id` (as listed by the app's chat list) or the suffix after `${appId}_` in the room JID. Needs an app: pass `appId` or select one with `ethora-app-select`. | |
| roomJid | No | Room JID `${appId}_${chatId}` (optionally with `@conference.<host>`), as returned by `ethora-app-create-chat`. Either this or `chatId` is required. | |
| senderName | No | Display name shown as the message sender (defaults to the app's broadcast sender / app name). | |
| waitForReplySec | No | Seconds to wait for a reply from someone else in the room (an AI agent, typically). 0 (default) returns right after posting. |