Custom UI Adapter Guide
Last updated 2026-02-12
Use this path when developers want to embed Rooaak messaging into their own app UI.
Reference implementation:
rooaak-custom-ui-sample-app
Architecture
- Browser/app sends message to your backend (
POST /api/chatin sample). - Backend calls Rooaak
POST /v1/agents/:id/messages. - Backend returns response immediately (
responded) or waits/polls for completion. - UI renders final assistant response.
Required env
ROOAAK_API_KEYROOAAK_AGENT_ID- optional:
ROOAAK_BASE_URL
Message contract
Use stable sessionId per conversation and include metadata:
{
"sessionId": "customer-123-thread-1",
"message": "hello",
"metadata": {
"channel": { "type": "custom_ui" },
"correlationId": "req-123"
}
}Production requirements
- Send
Idempotency-Keyon writes. - Verify your own app auth before forwarding user messages.
- Log
messageId,sessionId, andcorrelationIdfor traceability. - Handle
pendingstatus (poll/webhook completion).
Smoke test
curl -X POST https://<your-host>/api/chat \
-H 'Content-Type: application/json' \
-d '{
"sessionId":"qa-custom-ui",
"message":"Reply exactly: custom-ui-smoke-ok",
"idempotencyKey":"qa-custom-ui-1",
"correlationId":"qa-custom-ui-1"
}'Expected:
- HTTP
200 - JSON with
status: "responded"and assistant response text