recordMessages to your response handler and conversations start flowing into the dashboard.
Design principles
Fire-and-forget —
recordMessages catches all errors internally and never throws. If the OpenBat API is unreachable, the SDK logs the error and moves on. Your chatbot is never affected.Non-blocking — capturing runs in the background. Streaming latency is unaffected whether you call
recordMessages directly or use the withOpenBat wrapper.Deduplication — pass a message
id on each message and safely call recordMessages on every turn. Duplicate message IDs are ignored server-side, so you never insert the same message twice.Configurable — disable the SDK in test or CI environments with a single environment variable. No code changes needed.
What you can capture
Every call torecordMessages accepts a conversation ID, an array of messages, and optional metadata objects. The more metadata you provide, the more powerful your filtering and segmentation becomes in the dashboard.
| Data | Description |
|---|---|
| Conversation messages | User, assistant, and system messages with optional timestamps |
| User metadata | Name, email, plan, MRR, industry, account creation date |
| Organization metadata | Company name, plan, MRR, industry |
| Session metadata | Page URL, referrer, device type, country |
| Custom fields | Any key-value pairs matching your chatbot’s metadata schema |
Next steps
Installation
Install the SDK and configure your API key.
Recording messages
Full reference for the recordMessages method and all metadata options.
Vercel AI SDK
Use the withOpenBat wrapper for streaming responses.