Chats

Load message context around a target (for "jump to message" UX)

Auth: Tenant Actor

Returns the target message plus radius messages on each side, all from the same Mongo archive as /messages/search. Built for the "user clicks a search hit → land in the right spot of the chat" flow: one request gives the surrounding window of history so the frontend can render it and scroll the target into view.

Reads come from the archive (not MAM) so that whatever the search endpoint returned is guaranteed to be present in the context window.

Pagination semantics use a (createdAt, _id) tie-break, so two messages with the same millisecond timestamp don't reshuffle between requests. Use hasMoreBefore / hasMoreAfter to decide whether to fetch the next outer window.

Visibility identical to search: B2B sees everything, user tokens must have access to the requested chat (groupchat membership or private-chat participant), otherwise 403.

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

Request

  • Base URL: https://api.chat.ethora.com
  • URL: https://api.chat.ethora.com/v2/apps/{appId}/chats/{chatId}/messages/context
  • 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

Localpart (${appId}_${uuid} for groupchat, sorted-uuids for private).

Query parameters

aroundStanzaIdstring

XEP-0359 server-assigned id (preferred — globally unique within the chat). Provide this OR aroundMessageId.

aroundMessageIdstring

Client-side message id (XMPP <message id="...">). Fallback for clients that don't have a stanza-id.

radiusinteger

How many messages to load on each side of the target.

Response

Items are returned in chronological order (oldest first), with the target somewhere in the middle.

{
  items: [
    { _id, appId, chatId, chatType, room, from, fromUserId,
      to, toUserId, body, messageId, stanzaId, createdAt }
  ],
  target: { ...same shape as items[N]... },
  hasMoreBefore: boolean,
  hasMoreAfter:  boolean,
  appId, chatId, radius
}

Changes

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