Chats

Read message history for a chat (any type) from the MAM archive

Auth: Tenant Actor

Returns the message history for a single chat room, fetched directly from ejabberd's mod_mam archive table. Generic — works for any chat type (widget, group, private); this is the same endpoint the admin AI Widget Conversations modal calls for inline transcripts and which can be reused for any other chat-inspection surface.

The chat must exist AND belong to the requested app — even if the caller knows the chatId, archives for chats in other apps are not exposed.

Pagination uses a before cursor in milliseconds-since-epoch on the message timestamp. Pass nextBefore from a prior response back as before to fetch the next older page. Results are returned in chronological order (oldest first) so the UI can render top-to-bottom without re-sorting.

Installs that haven't wired the MAM_MYSQL_* env vars get mamUnavailable: true and an empty results array — the UI should render a "history viewer not configured" hint rather than a broken state.

get/v2/apps/{appId}/chats/{chatId}/messages

Request

  • Base URL: https://api.chat.ethora.com
  • URL: https://api.chat.ethora.com/v2/apps/{appId}/chats/{chatId}/messages
  • Auth: one of:
    • HTTP bearer
    • HTTP bearer

Path parameters

appIdstring required

Target App ID. Must be an app the calling actor owns or has been delegated access to.

chatIdstring required

Mongo _id of the chat row.

Query parameters

limitinteger

Maximum number of items to return per page. Server caps vary per endpoint; the response carries the actual page size.

beforeinteger

Cursor in ms-since-epoch (exclusive upper bound on ts).

Response

{
  results: [
    {
      id: string,             // ejabberd archive row id (stable, sortable)
      originId: string|null,  // client-side message id when available
      ts: number,             // ms-since-epoch
      from: string,           // sender bare JID
      nick: string,           // sender's MUC nickname
      body: string            // plain-text message body
    }
  ],
  total: number,
  nextBefore: number|null,
  chat: { _id: string, name: string, type: string },
  mamUnavailable: boolean    // true when MAM_MYSQL_* env not configured
}

Changes

No recorded changes to this operation across all 1 revision of this API.