Chat widget

Send a visitor message and get the reply (public)

Called by the chat widget for every message the visitor types. Needs the public chat token in ?token=, the Origin header and X-Conversation-Token. Works like POST /conversations/{id}/messages: the same assistant, the same checks, and with Accept: text/event-stream the same Server-Sent Events (delta, then done or error). Limits: 2000 characters per message, 30 turns per conversation, 6 messages per minute per conversation and 20 per minute per IP address. In live mode, every reply is billed per use from your prepaid balance and counts toward the public chat's daily spending limit (counted at a safe 3 cents a reply); beyond that limit, the request returns public_chat_limit_reached.

post/public/conversations/{id}/messages

Request

  • Base URL: https://api.hypamoon.com/api/v1
  • URL: https://api.hypamoon.com/api/v1/public/conversations/{id}/messages
  • Auth: API key in query parameter token

Path parameters

idstring uuid required

The id of the conversation.

Headers

X-Conversation-Tokenstring required

The conversation_token from POST /public/conversations. Only the visitor who started the conversation has it.

Accept'application/json' | 'text/event-stream'

text/event-stream streams the reply as Server-Sent Events; anything else returns a single JSON response.

Request body

textstring required

What the customer typed, at most 2000 characters. Send it as is; it is never treated as an instruction to the assistant.

Response

The visitor's message and the assistant's reply.

Changes

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