Chat9
APIWidget

Widget Messages

Incremental tail of the current conversation (public, no auth). Separate from ``/history`` rather than a mode of it, because they answer different questions and pay different prices. ``/history`` bootstraps: two conversations, rotation, separators, the ticket number — everything the widget needs once, on mount. This is the one the widget calls every few seconds while a human is answering, so it reads one conversation and returns only what the caller has not seen. The cursor is an opaque message id rather than a timestamp or an offset. That is what lets this become a long-poll or an SSE stream later without the client's logic changing: "everything after X" is the same request whether the answer comes back immediately, in thirty seconds, or as a stream of pushes. A timestamp cursor would have had to grow tie-breaking rules the moment two messages shared a second, and an offset would have broken the first time anything was inserted. Resolved by position rather than by comparing timestamps: the cursor is located in the conversation's own ordering and everything after it is returned. Two messages written in the same second cannot make it skip one.

GET
/widget/messages
/widget/messages

Query Parameters

bot_id
Required
Bot Id

Bot public ID

session_id
Required
Session Id

Chat session UUID

after_message_idAfter Message Id

Return messages written after this one

curl -X GET "https://api.getchat9.live/widget/messages?bot_id=string&session_id=string&after_message_id=string"

Successful Response

{
  "session_id": "1ffd059c-17ea-40a8-8aef-70fd0307db82",
  "messages": [
    {
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "role": "string",
      "content": "string"
    }
  ],
  "handoff_state": "bot",
  "chat_ended": false,
  "operator_label": "Support",
  "cursor_stale": false
}