Send Chat Message (Async)
Send a message to the AI chat assistant. The response is delivered asynchronously via WebSocket — subscribe to the UserChannel to receive the AI_CHAT_RESPONSE event.
Authentication: Required — Bearer token.
Prerequisites: LoyalStream connector must be enabled on the app.
Request body:
client_id(required) — Client-generated unique ID for tracking the conversationmessage(required) — The user’s message textconversation_id(optional) — Existing conversation ID to continue a conversation
Response:
status— “queued” (message is being processed)client_id— Echo of the client_id for correlation
Side effects:
- Broadcasts an
AI_CHAT_RESPONSEevent with “started” status immediately - Enqueues an
AiChatJobvia Sidekiq for async processing - The job broadcasts the AI response via WebSocket when complete
Errors:
403— LoyalStream connector not available500— Failed to enqueue the chat job
Authentication
AuthorizationBearer
Bearer authentication of the form Bearer <token>, where token is your auth token.
Request
This endpoint expects an object.
client_id
message
conversation_id
Response
OK